/* ==========================================================================
   КОСПЛЕЙ ХАУС — ЭКОСИСТЕМА (Стилистика без AI-slop)
   ========================================================================== */

:root {
  /* Палитра: глубокий спокойный фон, чистый белый текст, точечные акценты узлов */
  --bg-app: #080c16;
  --bg-surface: #0e1524;
  --bg-surface-hover: #151f34;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(255, 255, 255, 0.2);

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

  /* Акценты узлов экосистемы (согласно структуре) */
  --color-core: #38bdf8;        /* Косплей Хаус — циан */
  --color-promo: #f43f5e;       /* Косплей Промо — коралл */
  --color-crm: #10b981;         /* CRM для мастеров — изумруд */
  --color-pantheon: #f59e0b;    /* Пантеон лекторов — янтарь */
  --color-spb: #06b6d4;         /* Косплееры СПб — бирюза */
  --color-app: #38bdf8;         /* Приложения — небесно-голубой */

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Outfit', 'Inter', -apple-system, sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Контейнер приложения */
.app-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

/* Верхняя панель (минималистичная, строгая) */
.app-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 10;
  background: rgba(8, 12, 22, 0.7);
  border-bottom: 1px solid var(--border-subtle);
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  pointer-events: auto;
}

.brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.45));
}

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

.brand-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-tag {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Кнопки управления полотном */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  pointer-events: auto;
}

.ctrl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.ctrl-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-active);
  color: var(--text-primary);
}

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

/* Область отображения Canvas */
.canvas-viewport {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.canvas-viewport:active {
  cursor: grabbing;
}

#ecosystem-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Ненавязчивая подсказка */
.hint-toast {
  position: absolute;
  bottom: 44px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.4rem 0.9rem;
  background: rgba(14, 21, 36, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.5s ease;
  z-index: 5;
  white-space: nowrap;
}

.hint-toast.fade-out {
  opacity: 0;
}

/* Подсказка при выборе или наведении на узел */
.node-tooltip {
  position: absolute;
  bottom: 50px;
  right: 1.5rem;
  width: 290px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  z-index: 20;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  animation: tooltipFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.node-tooltip[hidden] {
  display: none;
}

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

.tooltip-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.tooltip-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  overflow: hidden;
}

.tooltip-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.tooltip-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.tooltip-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 0.75rem;
}

.tooltip-link-wrap[hidden] {
  display: none;
}

.tooltip-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #ffffff;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 6px;
  padding: 0.45rem 0.85rem;
  text-decoration: none;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.tooltip-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
  color: #ffffff;
  transform: translateY(-1px);
}

/* Нижняя строка копирайта */
.app-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  background: rgba(8, 12, 22, 0.8);
  pointer-events: none;
  z-index: 10;
}

.app-footer .dot {
  opacity: 0.4;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  pointer-events: auto;
  transition: color 0.15s ease;
}

.footer-link:hover {
  color: var(--text-secondary);
}

/* Адаптивность для мобильных */
@media (max-width: 640px) {
  .app-header {
    height: 56px;
    padding: 0 1rem;
  }

  .brand-logo {
    width: 32px;
    height: 32px;
  }

  .brand-name {
    font-size: 0.95rem;
  }

  .brand-tag {
    font-size: 0.68rem;
  }

  .ctrl-btn {
    width: 32px;
    height: 32px;
  }

  .node-tooltip {
    left: 1rem;
    right: 1rem;
    bottom: 44px;
    width: auto;
  }

  .hint-toast {
    font-size: 0.7rem;
    padding: 0.3rem 0.7rem;
    bottom: 38px;
  }
}
