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

body {
  overflow: hidden;
  background: #000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #e0e0e0;
}

#canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* Loading overlay */
#loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  gap: 16px;
}
#loading.hidden { display: none; }

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #4fc3f7;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#loading-text {
  font-size: 14px;
  color: #aaa;
}

/* Query panel */
#query-panel {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(20, 20, 30, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

#query-input {
  width: 320px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 14px;
  outline: none;
}
#query-input:focus {
  border-color: #4fc3f7;
}
#query-input::placeholder {
  color: #666;
}

#query-panel button {
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #e0e0e0;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
#query-panel button:hover {
  background: rgba(255, 255, 255, 0.15);
}
#query-btn {
  background: rgba(79, 195, 247, 0.2);
  border-color: rgba(79, 195, 247, 0.3);
}

/* Response panel */
#response-panel {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  padding: 10px 18px;
  background: rgba(20, 20, 30, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  font-size: 14px;
  max-width: 500px;
  text-align: center;
}
#response-panel.hidden { display: none; }

/* Sidebar */
#sidebar {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
  width: 200px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 14px;
  background: rgba(20, 20, 30, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}
#sidebar h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
  margin-bottom: 10px;
}

.concept-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  margin: 2px 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
}
.concept-item:hover {
  background: rgba(255, 255, 255, 0.1);
}
.concept-item .count {
  color: #4fc3f7;
  font-weight: 600;
}

/* Highlight spinner overlay */
#highlight-spinner {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  pointer-events: none;
}
#highlight-spinner.hidden { display: none; }

/* Mobile */
@media (max-width: 640px) {
  #query-input { width: 180px; }
  #sidebar { display: none; }
}
