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

body {
  background: #0a0e1a;
  color: #c8d0e0;
  font-family: 'SF Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

canvas {
  display: block;
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  cursor: grab;
}
canvas:active { cursor: grabbing; }

/* HUD */
#hud {
  position: absolute;
  top: 12px; left: 12px;
  pointer-events: none;
  z-index: 10;
}
#hud-title {
  font-size: 18px;
  font-weight: 700;
  color: #e0e8ff;
  letter-spacing: 1px;
  text-shadow: 0 0 20px rgba(100, 140, 255, 0.4);
}
#hud-stats {
  font-size: 11px;
  color: #6a7a9a;
  margin-top: 4px;
}
#hud-legend {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}
#hud-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #6a7a9a;
}
#hud-legend .legend-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Search */
#search-bar {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 10;
}
#search-input {
  width: 160px;
  padding: 6px 12px;
  border: 1px solid rgba(100, 140, 255, 0.2);
  border-radius: 16px;
  background: rgba(10, 14, 26, 0.85);
  color: #e0e8ff;
  font-size: 12px;
  outline: none;
  backdrop-filter: blur(8px);
}
#search-input:focus { border-color: rgba(100, 140, 255, 0.5); }
#search-input::placeholder { color: #4a5670; }
#search-results {
  margin-top: 4px;
  background: rgba(15, 20, 40, 0.95);
  border: 1px solid rgba(100, 140, 255, 0.2);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  backdrop-filter: blur(8px);
}
#search-results .search-item {
  padding: 6px 12px;
  font-size: 12px;
  color: #c8d0e0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
#search-results .search-item:hover { background: rgba(100, 140, 255, 0.1); }
#search-results .search-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Timeline */
#timelapse-btn {
  background: none;
  border: none;
  color: #6a7a9a;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  transition: color 0.2s;
}
#timelapse-btn:hover { color: #e0e8ff; }
#timelapse-btn.playing { color: #4a7aff; }
#timeline-bar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(10, 14, 26, 0.85);
  border: 1px solid rgba(100, 140, 255, 0.15);
  border-radius: 20px;
  padding: 8px 16px;
  z-index: 10;
  backdrop-filter: blur(8px);
}
#timeline-slider {
  width: 160px;
  accent-color: #4a7aff;
  cursor: pointer;
}
#timeline-label {
  font-size: 11px;
  color: #6a7a9a;
  min-width: 70px;
}

/* Tooltip */
#tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 20, 40, 0.95);
  border: 1px solid rgba(100, 140, 255, 0.3);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: #c8d0e0;
  z-index: 20;
  max-width: 200px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}
#tooltip .tag-name { font-weight: 600; color: #e0e8ff; }
#tooltip .tag-count { color: #6a7a9a; font-size: 11px; }
#tooltip .tag-cluster { color: #4a7aff; font-size: 10px; text-transform: uppercase; }

/* Modal */
#modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(5, 8, 16, 0.85);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
#modal-overlay.hidden { display: none; }

#modal {
  background: #111827;
  border: 1px solid rgba(100, 140, 255, 0.2);
  border-radius: 16px;
  padding: 24px;
  max-width: 480px;
  width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}
#modal-close {
  position: absolute;
  top: 12px; right: 16px;
  background: none;
  border: none;
  color: #6a7a9a;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}
#modal-close:hover { color: #e0e8ff; }

/* Post cards */
.post-card {
  background: rgba(20, 28, 50, 0.6);
  border: 1px solid rgba(100, 140, 255, 0.1);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.post-card:hover { border-color: rgba(100, 140, 255, 0.4); }
.post-card .pc-title {
  font-size: 14px;
  font-weight: 600;
  color: #e0e8ff;
  margin-bottom: 6px;
}
.post-card .pc-summary {
  font-size: 12px;
  color: #8a96b0;
  line-height: 1.4;
  margin-bottom: 8px;
}
.post-card .pc-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 10px;
}
.post-card .pc-mood {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(100, 140, 255, 0.15);
  color: #7aa0ff;
}
.post-card .pc-date { color: #4a5670; }
.post-card .pc-source { color: #4a5670; }

/* Post detail */
.post-detail .pd-title {
  font-size: 18px;
  font-weight: 700;
  color: #e0e8ff;
  margin-bottom: 12px;
}
.post-detail .pd-text {
  font-size: 14px;
  line-height: 1.6;
  color: #b0bcd0;
  margin-bottom: 16px;
}
.post-detail .pd-text b, .post-detail .pd-text strong { color: #e0e8ff; }
.post-detail .pd-text i, .post-detail .pd-text em { color: #8ab0ff; }
.post-detail .pd-text a { color: #4a7aff; text-decoration: none; }
.post-detail .pd-text a:hover { text-decoration: underline; }
.post-detail .pd-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.post-detail .pd-tag {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  background: rgba(100, 140, 255, 0.12);
  color: #7aa0ff;
}
.post-detail .pd-meta {
  font-size: 11px;
  color: #4a5670;
  border-top: 1px solid rgba(100, 140, 255, 0.1);
  padding-top: 10px;
}

/* Tag list header in modal */
.modal-header {
  font-size: 16px;
  font-weight: 700;
  color: #e0e8ff;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-header .cluster-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(100, 140, 255, 0.2); border-radius: 2px; }
