/* ==========================================================================
   AI Robotics & Skilled-Trade Data Ecosystem — Interactive Graph Styles
   Dark cosmic-editorial HUD with crisp glassmorphism & responsive layout
   ========================================================================== */

:root {
  --bg-deep: #060912;
  --bg-canvas: #080c17;
  --surface: rgba(13, 18, 32, 0.84);
  --surface-solid: #0f1526;
  --surface-hover: rgba(30, 41, 66, 0.72);
  --surface-active: rgba(56, 189, 248, 0.14);
  --border: rgba(148, 163, 184, 0.15);
  --border-strong: rgba(148, 163, 184, 0.28);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent: #38bdf8;
  --accent-indigo: #818cf8;
  --accent-emerald: #34d399;
  --accent-amber: #fbbf24;
  --accent-rose: #fb7185;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-hud: 0 12px 40px rgba(0, 0, 0, 0.52), 0 1px 0 rgba(255, 255, 255, 0.04) inset;

  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --topbar-h: 58px;
  --sidebar-w: 304px;
  --inspector-w: 392px;
}

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

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

.hidden {
  display: none !important;
}

/* Shell & Full-bleed Canvas */
.app-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% 45%, rgba(30, 58, 138, 0.14) 0%, transparent 65%),
    radial-gradient(ellipse 60% 50% at 85% 20%, rgba(14, 116, 144, 0.08) 0%, transparent 60%),
    var(--bg-deep);
}

#graph-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#graph-canvas.grabbing {
  cursor: grabbing;
}

#graph-canvas.pointer {
  cursor: pointer;
}

/* Glass HUD Panel Base */
.glass-panel {
  background: var(--surface);
  backdrop-filter: blur(16px) saturate(135%);
  -webkit-backdrop-filter: blur(16px) saturate(135%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-hud);
}

/* ==========================================================================
   Top Command Bar
   ========================================================================== */
.top-bar {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  height: var(--topbar-h);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 12px;
  z-index: 40;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 1;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.25));
  border: 1px solid rgba(99, 102, 241, 0.38);
  flex-shrink: 0;
}

.brand-dot {
  position: absolute;
  border-radius: 50%;
}
.brand-dot.d1 { width: 7px; height: 7px; top: 6px; left: 7px; background: #38bdf8; box-shadow: 0 0 8px #38bdf8; }
.brand-dot.d2 { width: 6px; height: 6px; bottom: 6px; right: 6px; background: #ec4899; }
.brand-dot.d3 { width: 5px; height: 5px; top: 14px; left: 10px; background: #34d399; }

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 1px;
}

.mono-pill {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--accent);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.22);
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
}

.meta-subtle {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Search Box */
.search-wrapper {
  position: relative;
  flex: 1 1 280px;
  max-width: 400px;
  min-width: 170px;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

#search-input {
  width: 100%;
  height: 36px;
  padding: 0 54px 0 33px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(6, 10, 20, 0.68);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

#search-input::placeholder {
  color: var(--text-muted);
}

#search-input:focus {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
  background: rgba(8, 13, 26, 0.92);
}

.search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 30px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 5px;
}
.search-clear:hover { color: var(--text-primary); }

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 360px;
  overflow-y: auto;
  background: rgba(11, 16, 30, 0.97);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
  z-index: 60;
  padding: 5px;
}

.search-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.1s ease;
}

.search-item:hover,
.search-item.active {
  background: rgba(56, 189, 248, 0.14);
}

.search-item-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}

.search-item-main {
  min-width: 0;
  flex: 1;
}

.search-item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-primary);
}

.search-item-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item-tier {
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.search-item-sub {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.search-empty {
  padding: 16px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* Right Top Bar Controls */
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.layout-segmented {
  display: inline-flex;
  background: rgba(6, 10, 20, 0.68);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 550;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.seg-btn:hover {
  color: var(--text-primary);
  background: rgba(148, 163, 184, 0.08);
}

.seg-btn.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.26), rgba(99, 102, 241, 0.28));
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35) inset;
}

.seg-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}

.seg-btn.active .seg-dot {
  opacity: 1;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.55);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.icon-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.icon-btn.small {
  width: 28px;
  height: 28px;
  font-size: 18px;
  line-height: 1;
}

/* ==========================================================================
   Ego Radial Banner
   ========================================================================== */
.ego-banner {
  position: fixed;
  top: calc(var(--topbar-h) + 22px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 7px 14px;
  border-radius: 999px;
  border-color: rgba(56, 189, 248, 0.35);
}

.ego-banner-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.ego-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #081226;
  background: var(--accent);
  padding: 2px 7px;
  border-radius: 999px;
}

#ego-center-label {
  font-weight: 600;
  color: var(--text-primary);
}

.ego-stats {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.ego-banner-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-secondary);
  cursor: pointer;
}

.inline-toggle input {
  accent-color: var(--accent);
  cursor: pointer;
}

.mini-btn {
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
}
.mini-btn:hover { background: rgba(255, 255, 255, 0.14); }

/* ==========================================================================
   Left Collapsible Sidebar
   ========================================================================== */
.sidebar {
  position: fixed;
  top: calc(var(--topbar-h) + 22px);
  left: 12px;
  bottom: 12px;
  width: var(--sidebar-w);
  border-radius: var(--radius-lg);
  z-index: 30;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}

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

.sidebar-scroll {
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
}

.filter-section {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.filter-section:last-child {
  border-bottom: none;
  padding-bottom: 4px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-head h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.count-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.sep {
  color: var(--text-muted);
  font-size: 10px;
}

.text-action {
  border: none;
  background: none;
  color: var(--accent);
  font-size: 11px;
  font-weight: 550;
  cursor: pointer;
  padding: 0;
  opacity: 0.85;
}
.text-action:hover { opacity: 1; text-decoration: underline; }

/* Quick Lens Presets */
.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.preset-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 2px;
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.5);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-chip:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.preset-chip.active {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.14);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.18) inset;
}

.preset-name {
  font-size: 11.2px;
  font-weight: 620;
  line-height: 1.25;
}

.preset-sub {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.2;
}

.preset-chip.active .preset-sub {
  color: #bae6fd;
}

/* Filter Rows (Niches & Edges) */
.filter-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s ease, opacity 0.12s ease;
  border: 1px solid transparent;
}

.filter-row:hover {
  background: rgba(148, 163, 184, 0.08);
}

.filter-row.off {
  opacity: 0.42;
}

.filter-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}

.filter-line-swatch {
  width: 15px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

.filter-label {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-solo {
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-secondary);
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.filter-row:hover .filter-solo {
  opacity: 1;
}

.filter-solo:hover {
  color: #fff;
  border-color: var(--accent);
}

.filter-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-secondary);
  min-width: 28px;
  text-align: right;
}

/* Tier Filters */
.tier-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.tier-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 7px 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.55);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tier-btn:hover {
  background: var(--surface-hover);
}

.tier-btn.off {
  opacity: 0.36;
}

.tier-btn.active {
  border-color: rgba(148, 163, 184, 0.34);
  background: rgba(30, 41, 66, 0.65);
}

.tier-circle-wrap {
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tier-circle {
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  background: rgba(148, 163, 184, 0.25);
}

.tier-name {
  font-size: 11px;
  font-weight: 600;
}

.tier-num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}

/* Display Controls */
.control-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.control-label {
  font-size: 12px;
  color: var(--text-primary);
}

.compact-select {
  background: rgba(6, 10, 20, 0.8);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 4px 8px;
  font-family: inherit;
  font-size: 11.5px;
  outline: none;
  cursor: pointer;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
}

.switch-row input {
  display: none;
}

.switch-ui {
  position: relative;
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.35);
  border: 1px solid var(--border);
  transition: background 0.18s ease;
}

.switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: transform 0.18s ease, background 0.18s ease;
}

.switch-row input:checked + .switch-ui {
  background: rgba(56, 189, 248, 0.35);
  border-color: rgba(56, 189, 248, 0.6);
}

.switch-row input:checked + .switch-ui::after {
  transform: translateX(14px);
  background: var(--accent);
}

.physics-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 2px;
}

.secondary-btn {
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: rgba(15, 23, 42, 0.72);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.14s ease;
}

.secondary-btn:hover {
  background: var(--surface-hover);
  border-color: rgba(56, 189, 248, 0.4);
}

.secondary-btn.paused {
  border-color: rgba(251, 191, 36, 0.55);
  color: var(--accent-amber);
}

/* Hints */
.hints-section {
  gap: 5px;
}

.hint-line {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.hint-line kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

/* ==========================================================================
   Right Node Inspector Drawer
   ========================================================================== */
.inspector {
  position: fixed;
  top: calc(var(--topbar-h) + 22px);
  right: 12px;
  bottom: 12px;
  width: var(--inspector-w);
  max-width: calc(100vw - 24px);
  border-radius: var(--radius-lg);
  z-index: 38;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
  user-select: text;
}

.inspector.closed {
  transform: translateX(calc(100% + 28px));
  opacity: 0;
  pointer-events: none;
}

.inspector-accent {
  height: 4px;
  width: 100%;
  background: var(--accent);
  flex-shrink: 0;
}

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 14px 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.inspector-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.badge-tier {
  background: rgba(148, 163, 184, 0.14);
  border-color: rgba(148, 163, 184, 0.25);
  color: var(--text-primary);
}

.badge-rel-high {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}

.badge-rel-medium {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fcd34d;
}

.badge-rel-low {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.25);
  color: var(--text-secondary);
}

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

.insp-title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.22;
  color: #fff;
}

.insp-subniche {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.insp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.5);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.24), rgba(99, 102, 241, 0.28));
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.primary-btn:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.36), rgba(99, 102, 241, 0.4));
  transform: translateY(-1px);
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: rgba(15, 23, 42, 0.65);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.ghost-btn:hover {
  background: var(--surface-hover);
  border-color: rgba(148, 163, 184, 0.45);
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.meta-card {
  background: rgba(8, 13, 25, 0.62);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 10px;
}

.meta-card.full {
  grid-column: 1 / -1;
}

.meta-k {
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.meta-v {
  font-size: 12.2px;
  color: var(--text-primary);
  word-break: break-word;
}

.insp-section {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.insp-section-title {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
}

.insp-prose {
  margin: 0;
  font-size: 12.6px;
  line-height: 1.55;
  color: #cbd5e1;
  background: rgba(8, 13, 25, 0.55);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
}

.pill-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
}

.pill.clickable {
  cursor: pointer;
  transition: all 0.13s ease;
}

.pill.clickable:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.45);
  color: #fff;
}

.pill.partner {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.24);
  color: #c7d2fe;
}

/* Connected Players Groups */
.neighbor-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 6px;
}

.neighbor-group-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 650;
  color: var(--text-secondary);
}

.neighbor-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(8, 13, 25, 0.65);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.14s ease;
}

.neighbor-card:hover {
  border-color: rgba(56, 189, 248, 0.48);
  background: rgba(30, 41, 66, 0.7);
  transform: translateX(2px);
}

.neighbor-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.neighbor-card-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.2px;
  font-weight: 620;
  color: var(--text-primary);
}

.neighbor-raw {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  flex-shrink: 0;
}

.neighbor-notes {
  font-size: 11.2px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.insp-sources {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  padding-top: 6px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
}

/* ==========================================================================
   Bottom-Right Minimap & Zoom Controls
   ========================================================================== */
.bottom-right-dock {
  position: fixed;
  right: 14px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 32;
  transition: right 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

body.inspector-open .bottom-right-dock {
  right: calc(var(--inspector-w) + 24px);
}

.minimap-wrap {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  padding: 4px;
}

#minimap-canvas {
  display: block;
  width: 184px;
  height: 122px;
  border-radius: 6px;
  background: rgba(5, 8, 16, 0.85);
  cursor: crosshair;
}

.minimap-label {
  position: absolute;
  top: 8px;
  left: 9px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: rgba(148, 163, 184, 0.65);
  pointer-events: none;
}

.zoom-bar {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: var(--radius-md);
}

.zoom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.14s ease;
}

.zoom-btn:hover {
  background: rgba(148, 163, 184, 0.14);
  color: #fff;
}

.zoom-readout {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  min-width: 44px;
  text-align: center;
}

.zoom-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 2px;
}

/* ==========================================================================
   Tooltip, Toast & Drop Zone
   ========================================================================== */
.tooltip {
  position: fixed;
  z-index: 70;
  pointer-events: none;
  max-width: 300px;
  padding: 9px 11px;
  border-radius: 10px;
  border-color: var(--border-strong);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.65);
}

.tt-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
}

.tt-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tt-name {
  font-size: 13px;
  font-weight: 680;
  color: #fff;
  line-height: 1.25;
}

.tt-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.tt-chip {
  font-family: var(--font-mono);
  font-size: 9.8px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
}

.tt-sub {
  font-size: 11.4px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.tt-scale {
  font-size: 11px;
  color: #bae6fd;
  line-height: 1.35;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #f8fafc;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 12.2px;
  font-weight: 550;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
}

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 9, 18, 0.82);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-card {
  border: 2px dashed rgba(56, 189, 248, 0.65);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.9);
  padding: 36px 48px;
  text-align: center;
  max-width: 440px;
}

.drop-icon {
  color: var(--accent);
  margin-bottom: 10px;
}

.drop-card h2 {
  margin: 0 0 6px;
  font-size: 17px;
  color: #fff;
}

.drop-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12.5px;
}

.drop-card code {
  font-family: var(--font-mono);
  color: var(--accent);
}

/* Custom Slim Dark Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.22);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.38);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1120px) {
  .brand-text h1 {
    max-width: 210px;
  }
  .meta-subtle {
    display: none;
  }
}

@media (max-width: 900px) {
  .top-bar {
    height: auto;
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 8px;
  }
  .search-wrapper {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
  }
  .sidebar {
    top: 112px;
    width: min(304px, calc(100vw - 24px));
  }
  .inspector {
    top: 112px;
    width: min(392px, calc(100vw - 24px));
  }
  .ego-banner {
    top: 112px;
    max-width: calc(100vw - 24px);
    flex-wrap: wrap;
    border-radius: 12px;
  }
  body.inspector-open .bottom-right-dock {
    right: 14px;
  }
  .minimap-wrap {
    display: none;
  }
}

@media (max-width: 600px) {
  .brand-block {
    display: none;
  }
  .seg-btn span:not(.seg-dot) {
    font-size: 11px;
  }
  .seg-btn {
    padding: 5px 7px;
  }
}
