/* ═══════════ TOPOLOGY - dark space theme ═══════════ */

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

:root {
  --bg: #030712;
  --bg-panel: #0a1428;
  --bg-panel-hi: #10192e;
  --border: #1a2540;
  --border-hi: #2a3a60;
  --text: #cbd5e1;
  --text-dim: #64748b;
  --text-hi: #f1f5f9;
  --cyan: #22d3ee;
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --purple: #a78bfa;
  --blue: #60a5fa;
  --pink: #ec4899;
  --orange: #f97316;
}

.topo-body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'JetBrains Mono', sans-serif;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(34, 211, 238, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(167, 139, 250, 0.08) 0%, transparent 50%);
}
.topo-body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0px, transparent 2px, rgba(255,255,255,0.01) 2px, rgba(255,255,255,0.01) 4px);
  z-index: 1;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; font-size: inherit; }
kbd {
  padding: 1px 6px;
  background: var(--bg);
  border: 1px solid var(--border-hi);
  border-radius: 3px;
  font-size: 9px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
}

/* ═══════════ TOP HUD ═══════════ */
.topo-hud {
  height: 44px;
  background: linear-gradient(180deg, rgba(10, 20, 40, 0.95) 0%, rgba(3, 7, 18, 0.95) 100%);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 14px;
  gap: 12px;
  flex-shrink: 0;
  z-index: 20;
  position: relative;
  backdrop-filter: blur(8px);
}
.hud-sep { width: 1px; height: 20px; background: var(--border-hi); }
.hud-flex { flex: 1; }
.hud-title { display: flex; flex-direction: column; }
.hud-title-main {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.08em;
  line-height: 1.1;
}
.hud-title-sub {
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.1;
}

.hud-btn {
  padding: 5px 10px;
  border: 1px solid var(--border-hi);
  background: rgba(10, 20, 40, 0.6);
  color: var(--text);
  font-size: 10px;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 4px;
  text-decoration: none;
  font-family: 'JetBrains Mono', monospace;
}
.hud-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.hud-btn.active { background: var(--cyan); color: var(--bg); border-color: var(--cyan); }
.hud-btn-primary { background: var(--cyan); color: var(--bg); border-color: var(--cyan); }
.hud-btn-primary:hover { background: #06b6d4; color: var(--bg); border-color: #06b6d4; }

.hud-section-nav {
  display: flex;
  gap: 3px;
  background: rgba(0,0,0,0.4);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.hud-section-nav .sec-btn {
  padding: 4px 10px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  transition: all 0.15s;
  font-family: 'JetBrains Mono', monospace;
}
.hud-section-nav .sec-btn:hover { color: var(--cyan); }
.hud-section-nav .sec-btn.active {
  background: var(--cyan);
  color: var(--bg);
}

/* ═══════════ MAIN ═══════════ */
.topo-main {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}
.topo-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.topo-canvas canvas { display: block; }

/* ═══════════ INFO PANEL (left top, floating) ═══════════ */
.topo-info-panel {
  position: absolute;
  top: 20px; left: 20px;
  max-width: 380px;
  padding: 16px 20px;
  background: rgba(10, 20, 40, 0.85);
  border: 1px solid var(--border-hi);
  border-radius: 10px;
  backdrop-filter: blur(12px);
  z-index: 10;
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.4);
  animation: infoSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes infoSlideIn {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}
.info-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.info-badge {
  font-size: 9px;
  font-weight: 700;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.15);
  border: 1px solid rgba(34, 211, 238, 0.35);
  padding: 3px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: 'JetBrains Mono', monospace;
}
.info-duration {
  font-size: 9px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}
.info-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-hi);
  line-height: 1.2;
  margin-bottom: 6px;
}
.info-subtitle {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  line-height: 1.4;
  margin-bottom: 10px;
}
.info-body {
  font-size: 11px;
  color: var(--text);
  line-height: 1.6;
}
.info-body p { margin-bottom: 6px; }
.info-body strong { color: var(--cyan); font-weight: 600; }
.info-body ul { padding-left: 14px; margin-top: 4px; }
.info-body li { margin-bottom: 3px; }

/* ═══════════ SECTION DOTS (right side vertical) ═══════════ */
.topo-dots {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 10px;
  z-index: 10;
}
.topo-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--border-hi);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.topo-dot:hover {
  background: var(--cyan);
  transform: scale(1.3);
}
.topo-dot.active {
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
  height: 24px;
  border-radius: 999px;
}
.topo-dot .dot-label {
  position: absolute;
  right: 22px; top: 50%;
  transform: translateY(-50%);
  background: rgba(10, 20, 40, 0.95);
  border: 1px solid var(--border-hi);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 10px;
  color: var(--text);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  font-family: 'JetBrains Mono', monospace;
}
.topo-dot:hover .dot-label { opacity: 1; }

/* ═══════════ LEGEND (left bottom) ═══════════ */
.topo-legend {
  position: absolute;
  left: 20px; bottom: 40px;
  padding: 10px 14px;
  background: rgba(10, 20, 40, 0.85);
  border: 1px solid var(--border-hi);
  border-radius: 8px;
  backdrop-filter: blur(8px);
  z-index: 10;
  font-size: 10px;
  display: flex; flex-wrap: wrap;
  gap: 8px 14px;
  max-width: 400px;
}
.legend-item {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
}
.legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
}

/* ═══════════ PROGRESS BAR (bottom, section-transition) ═══════════ */
.topo-progress-wrap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 10;
  padding: 0 20px 8px;
}
.topo-progress-track {
  height: 2px;
  background: rgba(30, 41, 59, 0.6);
  border-radius: 2px;
  overflow: hidden;
}
.topo-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 8px var(--cyan);
  width: 20%;
}

/* ═══════════ BOTTOM HELP ═══════════ */
.topo-help {
  height: 28px;
  background: rgba(10, 20, 40, 0.6);
  border-top: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 14px;
  gap: 14px;
  flex-shrink: 0;
  z-index: 20;
  position: relative;
  backdrop-filter: blur(8px);
}
.help-item {
  font-size: 9px;
  color: var(--text-dim);
  display: inline-flex; align-items: center; gap: 4px;
  font-family: 'JetBrains Mono', monospace;
}

/* ═══════════ TOAST ═══════════ */
.topo-toast-container {
  position: fixed;
  top: 60px; right: 20px;
  z-index: 100;
  display: flex; flex-direction: column; gap: 6px;
  pointer-events: none;
  max-width: 300px;
}
.topo-toast-container .toast {
  padding: 8px 12px;
  background: rgba(10, 20, 40, 0.95);
  border: 1px solid var(--border-hi);
  border-left: 3px solid var(--cyan);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text);
  pointer-events: auto;
  animation: toastIn 0.3s ease-out;
  backdrop-filter: blur(8px);
}
.topo-toast-container .toast.crisis { border-left-color: var(--red); }
.topo-toast-container .toast.success { border-left-color: var(--green); }
.topo-toast-container .toast.warning { border-left-color: var(--yellow); }
.topo-toast-container .toast.out { animation: toastOut 0.25s forwards; }
.topo-toast-container .toast .font-semibold { color: var(--text-hi); font-weight: 700; font-size: 11px; }
.topo-toast-container .toast .text-slate-600 { color: var(--text-dim); font-size: 10px; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); border-radius: 2px; }
