:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface-2: #1a1a24;
  --border: rgba(255,255,255,0.1);
  --cyan: #00f0ff;
  --magenta: #ff00aa;
  --green: #00cc66;
  --text: #e8e8f0;
  --muted: #6a6a7a;
}

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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 30px;
}

h1 {
  font-size: 2rem;
  background: linear-gradient(135deg, var(--cyan), var(--magenta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--muted);
  margin-top: 8px;
}

.controls {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--cyan);
  color: var(--bg);
}

.btn-primary:hover {
  background: #00d8e6;
}

.btn-primary:disabled {
  background: var(--muted);
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--cyan);
}

.idea-input {
  display: flex;
  gap: 10px;
}

.idea-input input {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  width: 300px;
}

.idea-input input:focus {
  outline: none;
  border-color: var(--cyan);
}

.status {
  text-align: center;
  padding: 10px;
  margin-bottom: 20px;
  border-radius: 8px;
  display: none;
}

.status.visible {
  display: block;
}

.status.loading {
  background: rgba(0, 240, 255, 0.1);
  color: var(--cyan);
}

.status.error {
  background: rgba(255, 68, 102, 0.1);
  color: #ff4466;
}

.status.success {
  background: rgba(0, 204, 102, 0.1);
  color: var(--green);
}

.visualization-container {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 20px;
}

#visualization {
  width: 100%;
  height: 600px;
}

#visualization svg {
  width: 100%;
  height: 100%;
}

.node-project {
  fill: var(--cyan);
  cursor: pointer;
  transition: r 0.2s;
}

.node-project:hover {
  fill: #00d8e6;
}

.node-idea {
  fill: var(--magenta);
  cursor: pointer;
}

.node-idea:hover {
  fill: #ff33bb;
}

.node-label {
  font-size: 10px;
  fill: var(--muted);
  pointer-events: none;
}

.tooltip {
  position: absolute;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  pointer-events: none;
  z-index: 100;
  max-width: 300px;
}

.tooltip h4 {
  color: var(--cyan);
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.tooltip p {
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.4;
}

.detail-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 320px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  z-index: 50;
}

.detail-panel.hidden {
  display: none;
}

.detail-panel h3 {
  color: var(--cyan);
  margin-bottom: 12px;
  padding-right: 30px;
}

.detail-panel p {
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 12px;
}

.detail-panel .close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.detail-panel .close-btn:hover {
  color: var(--text);
}

#detail-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

#detail-meta a {
  color: var(--cyan);
  text-decoration: none;
}

#detail-meta a:hover {
  text-decoration: underline;
}

.legend {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 20px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot.project {
  background: var(--cyan);
}

.dot.idea {
  background: var(--magenta);
}

.info {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.info p {
  margin: 4px 0;
}

/* Responsive */
@media (max-width: 768px) {
  .controls {
    flex-direction: column;
  }

  .idea-input {
    flex-direction: column;
    width: 100%;
  }

  .idea-input input {
    width: 100%;
  }

  #visualization {
    height: 400px;
  }

  .detail-panel {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    border-radius: 12px 12px 0 0;
  }
}
