/**
 * WikiHole - Styles v3
 * 
 * Comprehensive styling for the WikiHole knowledge exploration interface.
 * Features a dark space theme with glassmorphism effects, animated backgrounds,
 * and responsive design for both desktop and mobile devices.
 * 
 * Design Philosophy:
 * - Dark space theme to evoke exploration and discovery
 * - Glassmorphism for modern, layered visual depth
 * - Smooth animations and micro-interactions
 * - Accessibility-focused with proper contrast and ARIA support
 * - Mobile-responsive with touch-friendly interactions
 */

/* ── CSS CUSTOM PROPERTIES (TOKENS) ─────────────────────── */
:root {
  /* Background color palette - deep space theme */
  --bg:           #000000;   /* Pure black for deepest space */
  --bg-mid:       #0a0015;   /* Deep purple center gradient */
  --bg-outer:     #000510;   /* Dark blue edge gradient */
  
  /* Accent colors for UI elements and highlights */
  --cyan:         #00d4ff;
  --purple:       #6d28d9;
  --indigo:       #4f46e5;
  --pink:         #db2777;
  --teal:         #0ea5e9;

  /* Text color hierarchy for readability */
  --text:         #e2e6f8;           /* Primary text - high contrast */
  --text-muted:   rgba(226,230,248,0.45);  /* Secondary text */
  --text-faint:   rgba(226,230,248,0.2);   /* Tertiary text */

  /* Glassmorphism opacity levels for layered effects */
  --glass:        rgba(255,255,255,0.04);  /* Subtle glass base */
  --glass-mid:    rgba(255,255,255,0.07);  /* Medium glass */
  --glass-hi:     rgba(255,255,255,0.12);  /* High visibility glass */
  --glass-border: rgba(255,255,255,0.1);   /* Glass borders */
  --glass-border-hi: rgba(255,255,255,0.22); /* Highlighted borders */

  /* Node color system - 5 distinct colors for knowledge nodes */
  --nc-0: #38bdf8;  --ng-0: rgba(56,189,248,0.22);   --ns-0: rgba(56,189,248,0.06);  /* Cyan */
  --nc-1: #a78bfa;  --ng-1: rgba(167,139,250,0.22);  --ns-1: rgba(167,139,250,0.06);  /* Purple */
  --nc-2: #f472b6;  --ng-2: rgba(244,114,182,0.22);  --ns-2: rgba(244,114,182,0.06);  /* Pink */
  --nc-3: #34d399;  --ng-3: rgba(52,211,153,0.22);   --ns-3: rgba(52,211,153,0.06);  /* Green */
  --nc-4: #fbbf24;  --ng-4: rgba(251,191,36,0.22);   --ns-4: rgba(251,191,36,0.06);  /* Yellow */

  /* Border radius scale for consistent rounded corners */
  --r-sm: 10px; --r-md: 16px; --r-lg: 20px; --r-xl: 28px; --r-full: 9999px;
  
  /* Animation easing functions for smooth motion */
  --ease-spring: cubic-bezier(0.34,1.56,0.64,1);  /* Bouncy spring effect */
  --ease-out:    cubic-bezier(0.16,1,0.3,1);      /* Smooth deceleration */
}

/* ── CSS RESET & BASE STYLES ──────────────────────── */
*, *::before, *::after { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
}

html, body {
  width: 100%; 
  height: 100%;
  overflow: hidden;              /* Prevent scrollbars - app uses its own navigation */
  background: #000008;           /* Near-black background for space theme */
  color: var(--text);           /* Primary text color */
  font-family: 'Syne', sans-serif;  /* Primary font for headings and UI */
  cursor: none;                 /* Hide default cursor - we use custom cursor */
  -webkit-font-smoothing: antialiased;  /* Better font rendering on macOS */
}

button, input, a { cursor: none; }

::selection { background: rgba(56,189,248,0.2); color: var(--text); }
:focus-visible { outline: 1px solid var(--cyan); outline-offset: 3px; border-radius: var(--r-sm); }

/* ── CURSOR (ring only, no dot) ─────────── */
#cursor {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 9999;
}

#cursor-ring {
  position: absolute;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1.5px solid rgba(56,189,248,0.65);
  background: radial-gradient(circle, rgba(56,189,248,0.06), transparent 70%);
  transform: translate(-50%,-50%);
  transition: width .25s var(--ease-spring), height .25s var(--ease-spring),
              border-color .3s ease, background .3s ease;
  box-shadow: 0 0 10px 2px rgba(56,189,248,0.25), 0 0 28px 6px rgba(56,189,248,0.07);
}

body.cursor-hover #cursor-ring {
  width: 48px; height: 48px;
  border-color: rgba(244,114,182,0.8);
  background: radial-gradient(circle, rgba(244,114,182,0.08), transparent 70%);
  box-shadow: 0 0 12px 3px rgba(244,114,182,0.35), 0 0 30px 8px rgba(244,114,182,0.08);
}

/* ── BACKGROUND ─────────────────────────── */
#starfield {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}
#nebula { display: none; }
.nb { display: none; }

#grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  background-size: 180px; opacity: 0.55;
}

/* ── SCREENS ─────────────────────────────── */
.screen {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: opacity .55s var(--ease-out);
}
.screen:not(.active) { opacity:0; pointer-events:none; }
.screen.active        { opacity:1; pointer-events:all; }
.screen.exit          { opacity:0; pointer-events:none; }

/* ── LANDING SCREEN ──────────────────────── */
#screen-landing {
  gap: 0;
  padding: 0 24px;
  /* Use fixed vertical positions so nothing shifts */
}

/* Brand — static, centered */
#brand {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 36px;

}

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

.logo {
  font-family: 'Syne', sans-serif; font-weight: 800;
  font-size: clamp(2.2rem, 5vw, 3.2rem); letter-spacing: -0.04em; line-height: 1;
  background: linear-gradient(120deg, #e0f2fe 0%, #38bdf8 25%, #818cf8 50%, #a78bfa 75%, #f97316 100%);
  background-clip: text; -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 0 24px rgba(56,189,248,0.35));
}

.tagline {
  font-family: 'DM Mono', monospace; font-weight: 300; font-style: italic;
  font-size: 0.76rem; letter-spacing: 0.07em; color: var(--text-muted);
}

/* Mode Toggle */
#mode-toggle {
  position: relative; display:flex; align-items:stretch; gap:0px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-xl); padding: 5px;
  margin-bottom: 20px;
  width: 100%; max-width: 520px;
  box-shadow: 0 8px 36px rgba(0,0,0,0.55);
  animation: none;
}

.mode-btn {
  position:relative; z-index:1; flex: 1;
  display:flex; flex-direction:row; align-items:center; justify-content: flex-start; gap:8px;
  padding: 12px 20px;
  background:transparent; border:none;
  border-radius: calc(var(--r-xl) - 4px);
  color: var(--text-muted);
  transition: color .3s ease;
  white-space: nowrap;
}
.mode-btn[data-mode="explore"] { padding-left: 10px; }
.mode-btn[data-mode="bridge"] { padding-left: 20px; }
.mode-btn.active { color: var(--text); }
.mode-icon { font-size:1.1rem; line-height:1; display:inline-block; transition: transform .4s var(--ease-spring), filter .3s ease; }
.mode-btn.active .mode-icon { filter: drop-shadow(0 0 5px currentColor); transform:scale(1.12); }
.mode-name { font-family:'Syne',sans-serif; font-weight:700; font-size:.85rem; letter-spacing:.01em; }
.mode-sub  { font-family:'DM Mono',monospace; font-size:.6rem; letter-spacing:.04em; opacity:.6; font-weight:300; }
.mode-sub::before { content: '•'; margin-right: 4px; opacity: 0.4; }
.mode-divider { width:1px; background:var(--glass-border); margin:6px 2px 6px 2px; flex-shrink:0; }

.mode-indicator {
  position:absolute; top:5px; bottom:5px; left:5px;
  width: calc(50% + 6px);
  background: rgba(255,255,255,0.05);
  border-radius: calc(var(--r-xl) - 5px);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: none;
  transition: left .42s var(--ease-spring), width .42s var(--ease-spring);
  pointer-events: none;
}
.mode-indicator.right { left: calc(50% + 28px); width: calc(50% - 33px); }

/* Panels wrapper — FIXED HEIGHT so nothing shifts */
.panels-wrap {
  width: 100%; max-width: 520px;
  height: 160px;
  position: relative;
  animation: none;
}

/* Input panels — absolutely stacked in fixed container */
.input-panel {
  position: absolute; top:0; left:0; right:0;
  transition: opacity .32s ease;
  pointer-events: none;
}
.input-panel:not(.active) { opacity:0; pointer-events:none; }
.input-panel.active       { opacity:1; pointer-events:all; }

/* Glass input shell */
.glass-input-shell {
  display:flex; align-items:center; gap:8px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-xl);
  padding: 10px 8px 10px 18px;
  min-height: 50px;
  width: 100%; max-width: 520px;
  box-shadow: 0 8px 36px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.12);
  transition: border-color .3s ease, box-shadow .3s ease;
}
.glass-input-shell:focus-within {
  border-color: var(--glass-border);
  box-shadow: 0 8px 36px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.16);
}

.text-input {
  flex:1; background:transparent; border:none; outline:none;
  font-family:'DM Mono',monospace; font-size:0.76rem; font-weight:400;
  color:var(--text); letter-spacing:.01em; min-width:0;
  line-height: 1.6;
  padding: 3px 0;
}
.text-input::placeholder { color:var(--text-faint); font-style:italic; font-weight:300; }
.text-input:focus { outline:none; }

/* Dive-in button — liquid glass style */
.dive-btn {
  position:relative; display:flex; align-items:center; gap:7px; flex-shrink:0;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.2);
  border-top: 1px solid rgba(255,255,255,0.32);
  border-radius: calc(var(--r-xl) - 2px);
  padding: 11px 20px;
  color: rgba(255,255,255,0.92);
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: .85rem; letter-spacing: .03em;
  overflow: hidden;
  transition: background .25s ease, border-color .25s ease, transform .2s var(--ease-spring), box-shadow .25s ease;
  box-shadow: 0 2px 16px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.22), inset 0 -1px 0 rgba(0,0,0,0.1);
}
.dive-btn::before {
  content:''; position:absolute; inset:0;
  background: linear-gradient(135deg, rgba(255,255,255,0.12) 0%, transparent 60%);
  pointer-events:none;
}
.dive-btn:disabled { opacity:.3; pointer-events:none; }
.dive-btn:not(:disabled):hover {
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.3);
  transform: scale(1.04);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.28), 0 0 24px rgba(56,189,248,0.12);
}
.dive-btn:not(:disabled):active { transform:scale(0.97); }
.btn-arrow { transition: transform .2s ease; }
.dive-btn:not(:disabled):hover .btn-arrow { transform: translateX(3px); }

/* Bridge panel layout */
.bridge-shell {
  flex-direction: column;
  gap: 0px;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.bridge-row {
  display:flex; align-items:center; gap:8px; width:100%;
}
.bridge-field {
  display:flex; align-items:center; gap:8px; flex:1; min-width:0;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-full);
  padding: 10px 14px;
  min-height: 50px;
  transition: border-color .3s ease, box-shadow .3s ease;
}
.bridge-field:focus-within {
  border-color: var(--glass-border);
  box-shadow: none;
}
.bridge-label {
  font-family:'DM Mono',monospace; font-size:.68rem; font-weight:500;
  letter-spacing:.1em; text-transform:uppercase;
  color: rgba(56,189,248,0.8); flex-shrink:0;
}
.bridge-connector {
  display:flex; align-items:center; flex-shrink:0;
  color: var(--text-muted); font-size:1rem;
  filter: drop-shadow(0 0 4px rgba(56,189,248,0.3));
}
.bridge-dive { align-self:stretch; justify-content:center; width:100%; }

/* Input hints */
.input-hint {
  margin-top:12px; font-family:'DM Mono',monospace; font-size:0.76rem;
  color:var(--text-faint); text-align:center; letter-spacing:.03em;
}
.bridge-shell .input-hint {
  margin-top:12px; font-family:'DM Mono',monospace; font-size:0.76rem;
  color:var(--text-faint); text-align:center; letter-spacing:.03em;
}
.hint-tag {
  color:var(--text-muted); cursor:none;
  text-decoration:underline; text-decoration-style:dotted; text-underline-offset:3px;
  transition: color .2s ease;
}
.hint-tag:hover { color:var(--cyan); }

/* ── GALAXY SCREEN ───────────────────────── */
#screen-galaxy { justify-content:flex-start; align-items:stretch; overflow:hidden; }

/* Controls bar — overlays everything, z-index above world */
#galaxy-controls {
  position:absolute; top:0; left:0; right:0; z-index:200;
  display:flex; align-items:center; justify-content:space-between;
  padding: 18px 24px;
  background: linear-gradient(to bottom, rgba(0,2,10,0.88) 0%, transparent 100%);
  pointer-events:none;
}
#galaxy-controls > * { pointer-events:all; }

.glass-btn {
  display:flex; align-items:center; gap:6px;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border); border-radius:var(--r-full);
  padding: 8px 16px; color:var(--text-muted);
  font-family:'DM Mono',monospace; font-size:.75rem; letter-spacing:.04em;
  transition: background .2s ease, color .2s ease, transform .2s var(--ease-spring);
  box-shadow: 0 3px 12px rgba(0,0,0,0.3);
}
.glass-btn:hover { background:var(--glass-mid); color:var(--text); transform:scale(1.04); }
.glass-btn:active { transform:scale(0.97); }

#galaxy-header {
  display:flex; align-items:center; gap:10px;
  background:var(--glass); backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px);
  border:1px solid var(--glass-border); border-radius:var(--r-full);
  padding:7px 16px; box-shadow:0 3px 12px rgba(0,0,0,0.3);
}
#galaxy-topic-label {
  font-family:'Syne',sans-serif; font-weight:700; font-size:.85rem; letter-spacing:.01em; color:var(--text);
  max-width:220px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
#galaxy-mode-badge {
  font-family:'Syne',sans-serif; font-weight:700; font-size:.85rem; letter-spacing:.01em;
  padding:2px 9px; border-radius:var(--r-full);
}
/* Both badges use same pink accent */
#galaxy-mode-badge.explore { background:rgba(244,114,182,0.12); color:#f472b6; border:1px solid rgba(244,114,182,0.25); }
#galaxy-mode-badge.bridge  { background:rgba(244,114,182,0.12); color:#f472b6; border:1px solid rgba(244,114,182,0.25); }

/* ── Keyboard focus ring — natural colored glow ── */
.knowledge-node.keyboard-focus .node-card {
  border-color: var(--nc) !important;
  border-top-color: var(--nc) !important;
  box-shadow:
    0 0 0 1.5px var(--nc),
    0 0 16px var(--ng),
    0 0 48px var(--ng),
    0 0 80px rgba(0,0,0,0),
    0 16px 48px rgba(0,0,0,0.7),
    inset 0 1px 0 rgba(255,255,255,0.35) !important;
  background: linear-gradient(
    145deg,
    rgba(255,255,255,0.17) 0%,
    rgba(255,255,255,0.07) 50%,
    rgba(255,255,255,0.12) 100%
  ) !important;
}

/* World layer — zooms & pans, background stays fixed */
#world {
  position: absolute; inset: 0;
  transform-origin: 50% 50%;
  will-change: transform;
  z-index: 10;
}

/* SVG edges — behind nodes */
#svg-edges {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none; overflow: visible; z-index: 11;
}

/* Pulse dot SVG — above nodes so dots always travel in front of cards */
#svg-dots {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none; overflow: visible; z-index: 30;
}

/* Nodes layer */
#nodes-layer {
  position: absolute; inset: 0;
  pointer-events: none; z-index: 12;
}

/* ── EDGES — solid glowing white glass lines ── */
/* outer glow — widest, most transparent */
.edge-glow-3 { display: none; }
.edge-glow-2  { display: none; }
.edge-glow    { display: none; }
.edge-path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 1.5px;
  stroke-linecap: round;
  animation: edge-line-pulse 2.8s ease-in-out infinite;
}
.bridge-glow {
  stroke: rgba(255, 255, 255, 0.3);
}
.bridge-path {
  stroke: rgba(255, 255, 255, 0.7);
  stroke-width: 1.8px;
}
.edge-label-text {
  font-family:'DM Mono',monospace; font-size:9px; font-style:italic;
  fill:rgba(226,230,248,0.28); letter-spacing:.03em; pointer-events:none;
}
.edge-group:hover .edge-path { stroke-opacity: 1; }
.edge-group:hover .edge-glow { opacity: 0.7; }
.edge-group:hover .edge-label-text { fill:rgba(226,230,248,0.55); }

/* ── KNOWLEDGE NODE CARDS ───────────────── */
.knowledge-node {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: all; z-index: 20;
  --nc: #38bdf8; --ng: rgba(56,189,248,0.2); --ns: rgba(56,189,248,0.06);
}

/* The glass card — always visible */
.node-card {
  position: relative;
  background: linear-gradient(
    145deg,
    rgba(255,255,255,0.13) 0%,
    rgba(255,255,255,0.05) 50%,
    rgba(255,255,255,0.09) 100%
  );
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid rgba(255,255,255,0.15);
  border-top: 1px solid rgba(255,255,255,0.32);
  border-left: 1px solid rgba(255,255,255,0.2);
  border-radius: 18px;
  padding: 16px 18px 14px;
  width: auto;
  min-width: 240px;
  max-width: 340px;
  box-shadow:
    0 0 0 1px var(--ns),
    0 12px 40px rgba(0,0,0,0.65),
    0 4px 16px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.22),
    inset 0 0 28px rgba(255,255,255,0.025);
  transition: border-color .25s ease, box-shadow .25s ease, transform .25s var(--ease-spring);
}

/* Top shimmer line with node color tint */
.node-card::before {
  content:''; position:absolute;
  top:0; left:14px; right:14px; height:1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), var(--ng), rgba(255,255,255,0.55), transparent);
  border-radius:1px; pointer-events:none;
}

/* Colored accent bottom edge */
.node-card::after {
  content:''; position:absolute;
  bottom:0; left:20px; right:20px; height:1px;
  background: linear-gradient(90deg, transparent, var(--nc), transparent);
  opacity: 0.45;
  border-radius:1px; pointer-events:none;
}

.knowledge-node:hover .node-card {
  border-color: rgba(255,255,255,0.28);
  border-top-color: rgba(255,255,255,0.45);
  box-shadow:
    0 0 0 1px var(--ng),
    0 0 24px var(--ns),
    0 16px 48px rgba(0,0,0,0.7),
    inset 0 1px 0 rgba(255,255,255,0.3),
    inset 0 0 28px rgba(255,255,255,0.04);
  /* no translateY — prevents lines from popping outside card edges */
}

.knowledge-node.is-root .node-card {
  max-width: 340px;
  background: linear-gradient(145deg, rgba(255,255,255,0.14) 0%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.1) 100%);
  border-color: rgba(255,255,255,0.2);
  border-top-color: rgba(255,255,255,0.35);
  box-shadow: 0 0 0 1px var(--ng), 0 12px 44px rgba(0,0,0,0.65), inset 0 1px 0 rgba(255,255,255,0.25), 0 0 28px var(--ns);
}

.knowledge-node.depth-1 .node-card { max-width: 340px; }
.knowledge-node.depth-2 .node-card { max-width: 340px; }
.knowledge-node.depth-3 .node-card { max-width: 340px; }

/* Float animation removed - cards are now static */

/* Spawn animation (overrides float briefly) */
.knowledge-node.spawning {
  animation: node-spawn .65s var(--ease-spring) both;
}

/* Card text */
.node-card-header {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 7px;
}
.node-card-topic {
  font-family:'Syne',sans-serif; font-weight:700; font-size:.85rem; letter-spacing:.01em;
  color:rgba(255,255,255,0.95);
  white-space: normal; word-break: break-word; overflow-wrap: break-word;
  text-shadow: 0 0 12px var(--ng);
  line-height: 1.3;
  flex: 1;
  text-transform: lowercase;
}
.node-card-fact {
  font-family:'DM Mono',monospace; font-style:italic; font-weight:300;
  font-size:.79rem; line-height:1.6; color:rgba(226,230,248,0.86);
  margin-bottom:10px;
  overflow-wrap: break-word; word-break: break-word;
  text-transform: lowercase;
}
.node-card-link {
  font-family:'DM Mono',monospace; font-size:.6rem; letter-spacing:.04em;
  color:rgba(226,230,248,0.35); border-top:1px solid rgba(255,255,255,0.08);
  padding-top:7px; margin-bottom:9px; font-style:italic;
  word-break: break-word; line-height: 1.4;
  text-transform: lowercase;
}
.link-arrow {
  color: var(--nc);
  opacity: 0.7;
  font-style: normal;
}
.node-card-actions { display:flex; }

.node-expand-btn {
  flex:1; display:flex; align-items:center; justify-content:center; gap:4px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.11);
  border-radius: var(--r-full);
  padding: 6px 12px; color:rgba(255,255,255,0.6);
  font-family:'DM Mono',monospace; font-size:.66rem; font-weight:500; letter-spacing:.04em;
  transition: background .2s ease, color .2s ease, transform .2s var(--ease-spring);
}
.node-expand-btn:hover { background:rgba(255,255,255,0.11); color:rgba(255,255,255,0.9); transform:scale(1.03); }
.node-expand-btn:active { transform:scale(0.97); }
.node-expand-btn:disabled { opacity:.3; pointer-events:none; }
.node-expand-btn.loading { animation:btn-pulse 1s ease-in-out infinite; }

/* Hide edge label text entirely */
.edge-label-text { display: none !important; }
.edge-group:hover .edge-label-text { display: none !important; }

/* Bridge mode — no floating */
#screen-galaxy.bridge-mode .knowledge-node {
  animation: node-spawn 0.65s var(--ease-spring) both;
}

/* keyboard-focus rule defined above near galaxy controls */

/* Traveling pulse dot */
.edge-pulse-dot {
  fill: rgba(255, 255, 255, 0.92);
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.9)) drop-shadow(0 0 8px rgba(255, 255, 255, 0.5));
}

/* ── LOADING ─────────────────────────────── */
.galaxy-loading {
  position:absolute; inset:0; z-index:300;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:24px;
  background:rgba(0,2,10,0.72); backdrop-filter:blur(22px) saturate(150%);
  -webkit-backdrop-filter:blur(22px) saturate(150%);
  transition:opacity .4s ease;
}
.galaxy-loading.hidden { opacity:0; pointer-events:none; }

.gl-orb { position:relative; width:76px; height:76px; }
.gl-core {
  position:absolute; inset:50%; transform:translate(-50%,-50%);
  width:18px; height:18px; border-radius:50%;
  background:radial-gradient(circle,white,var(--cyan));
  box-shadow:0 0 18px 7px rgba(56,189,248,0.55),0 0 36px 14px rgba(56,189,248,0.18);
  animation:core-pulse 1.5s ease-in-out infinite;
}
.gl-ring { position:absolute; inset:50%; border-radius:50%; transform:translate(-50%,-50%); border:1.5px solid; }
.gl-r1 { width:40px;height:40px; border-color:rgba(56,189,248,0.35); animation:ring-spin 2s linear infinite; }
.gl-r2 { width:60px;height:60px; border-color:rgba(109,40,217,0.3); animation:ring-spin 3s linear infinite reverse; }
.gl-r3 { width:80px;height:80px; border-color:rgba(244,114,182,0.2); animation:ring-spin 4s linear infinite; }
#gl-status {
  font-family:'DM Mono',monospace; font-size:.78rem; font-weight:300; font-style:italic;
  color:var(--text-muted); letter-spacing:.08em; animation:text-flicker 2s ease-in-out infinite;
}

/* ── TOAST ───────────────────────────────── */
#toast-container {
  position:fixed; bottom:32px; left:50%; transform:translateX(-50%);
  display:flex; flex-direction:column; gap:8px; z-index:9000; pointer-events:none;
}
.toast {
  background:rgba(255,255,255,0.07); backdrop-filter:blur(20px);
  border:1px solid var(--glass-border); border-radius:var(--r-full);
  padding:9px 18px; font-family:'DM Mono',monospace; font-size:.75rem; color:var(--text-muted);
  animation:toast-in .4s var(--ease-spring) both; box-shadow:0 4px 16px rgba(0,0,0,0.4);
}
.toast.error { border-color:rgba(244,114,182,0.35); color:#f472b6; }

/* ── KEYFRAMES ───────────────────────────── */
@keyframes fade-in-panels {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes fade-up {
  from { opacity:0; transform:translateY(22px); }
  to   { opacity:1; transform:translateY(0); }
}
@keyframes nebula-drift {
  0%   { transform:translate(0,0) scale(1); }
  33%  { transform:translate(4%,-3%) scale(1.05); }
  66%  { transform:translate(-3%,5%) scale(0.97); }
  100% { transform:translate(2%,-2%) scale(1.03); }
}
@keyframes edge-glow-pulse {
  0%, 100% { opacity: 0.35; stroke-width: 8px; }
  50%       { opacity: 0.65; stroke-width: 12px; }
}
@keyframes edge-line-pulse {
  0%, 100% { stroke-opacity: 0.6; }
  50%       { stroke-opacity: 1; }
}
@keyframes node-spawn {
  0%   { opacity:0; transform:translate(-50%,-50%) scale(0.3) rotate(-15deg); }
  60%  { opacity:1; transform:translate(-50%,-50%) scale(1.08) rotate(3deg); }
  100% { opacity:1; transform:translate(-50%,-50%) scale(1) rotate(0deg); }
}
@keyframes node-float {
  0%,100% { transform:translate(-50%,-50%) translateY(0px); }
  50%     { transform:translate(-50%,-50%) translateY(-5px); }
}
@keyframes ring-spin {
  from { transform:translate(-50%,-50%) rotate(0deg); }
  to   { transform:translate(-50%,-50%) rotate(360deg); }
}
@keyframes core-pulse {
  0%,100% { transform:translate(-50%,-50%) scale(1); opacity:1; }
  50%      { transform:translate(-50%,-50%) scale(1.35); opacity:.7; }
}
@keyframes btn-pulse { 0%,100%{opacity:1;} 50%{opacity:.45;} }
@keyframes text-flicker { 0%,100%{opacity:1;} 50%{opacity:.5;} }
@keyframes toast-in { from{opacity:0;transform:translateY(6px) scale(.96);} to{opacity:1;transform:translateY(0) scale(1);} }
@keyframes warp-in {
  0%  { opacity:0; transform:scale(1.1); filter:blur(6px); }
  70% { opacity:1; filter:blur(0); }
  100%{ opacity:1; transform:scale(1); }
}

#screen-galaxy.active { animation: warp-in .65s var(--ease-out) both; }

/* ── RESPONSIVE ──────────────────────────── */
@media (max-width:600px) {
  
  .logo { font-size:2rem; }
  .mode-btn { padding:10px 18px; }
  .mode-sub { display:none; }
  .bridge-row { flex-direction:column; }
  .bridge-connector { display:none; }
  #galaxy-controls { padding:12px 14px; }
}

/* ── UTILITY ─────────────────────────────── */
.hidden { display:none !important; }
::-webkit-scrollbar { width:4px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--glass-border); border-radius:10px; }