/* ============================================================
   Filmograph — Dark cinematic graph visualization
   Three views: Graph, Gallery, Constellation
   ============================================================ */

:root {
  --bg-deep: #0a0a0f;
  --bg-sidebar: #111118;
  --bg-card: #1a1a25;
  --bg-card-hover: #222235;
  --border: #2a2a3a;
  --border-focus: #3a3a5a;
  --text: #e0e0e8;
  --text-muted: #8888a0;
  --text-dim: #555570;
  --accent-gold: #ffd700;
  --accent-teal: #2dd4bf;
  --accent-coral: #f97066;
  --accent-blue: #60a5fa;
  --accent-green: #4ade80;
  --accent-gray: #9ca3af;
  --accent-muted: #6b7280;
  --radius: 8px;
  --radius-sm: 5px;
  --transition: 300ms cubic-bezier(.4, 0, .2, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --sidebar-w: 280px;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---- Layout ---- */
.app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 20px 18px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-header h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .02em;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.sidebar-header h1 svg {
  opacity: .55;
  flex-shrink: 0;
}

.sidebar-header .subtitle {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 3px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar-scroll::-webkit-scrollbar { width: 5px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.filter-section {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.filter-section:last-child { border-bottom: none; }

.filter-section h3 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

/* Search */
.search-wrap {
  position: relative;
}

.search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  padding: 8px 10px 8px 32px;
  outline: none;
  transition: border-color var(--transition);
}

.search-input::placeholder { color: var(--text-dim); }
.search-input:focus { border-color: var(--border-focus); }

/* Checkboxes & Radios */
.filter-group { display: flex; flex-direction: column; gap: 7px; }

.filter-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  transition: color var(--transition);
  user-select: none;
}

.filter-group label:hover { color: var(--text); }

.filter-group input[type="checkbox"],
.filter-group input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--border-focus);
  border-radius: 3px;
  background: var(--bg-card);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 150ms ease;
}

.filter-group input[type="radio"] { border-radius: 50%; }

.filter-group input[type="checkbox"]:checked,
.filter-group input[type="radio"]:checked {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}

.filter-group input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3.5px;
  top: 1px;
  width: 4px;
  height: 7px;
  border: solid var(--bg-deep);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.filter-group input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 5px;
  height: 5px;
  background: var(--bg-deep);
  border-radius: 50%;
}

.type-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.type-dot.diamond { border-radius: 1px; transform: rotate(45deg); width: 7px; height: 7px; }
.type-dot.triangle { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 8px solid var(--accent-green); background: none !important; border-radius: 0; }
.type-dot.rect { border-radius: 2px; width: 10px; height: 7px; }

/* Toggle switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.toggle-wrap:hover { color: var(--text); }

.toggle-switch {
  position: relative;
  width: 32px;
  height: 18px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 9px;
  transition: background 200ms ease;
}

.toggle-switch input:checked + .toggle-track {
  background: var(--accent-blue);
}

.toggle-track::after {
  content: '';
  position: absolute;
  left: 2px;
  top: 2px;
  width: 14px;
  height: 14px;
  background: var(--text);
  border-radius: 50%;
  transition: transform 200ms ease;
}

.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(14px);
}

/* Highlight depth slider */
.highlight-depth-wrap {
  margin-top: 10px;
}

.highlight-depth-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.highlight-depth-label span {
  color: var(--text);
  font-weight: 600;
}

.highlight-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}

.highlight-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent-blue);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--bg-sidebar);
}

.highlight-depth-hints {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Layout section */
.layout-mode-wrap,
.layout-sub {
  margin-bottom: 8px;
}

.layout-mode-label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 3px;
}

.force-sliders {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.force-slider-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.force-slider-row label {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.force-slider-row label span {
  color: var(--text);
  font-weight: 600;
  font-size: 10px;
}

.slider-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  cursor: help;
  position: relative;
  flex-shrink: 0;
}

.slider-help:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: #1e1e2e;
  border: 1px solid #3a3a50;
  color: #c0c0d0;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 400;
  white-space: normal;
  width: 180px;
  z-index: 100;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.link-type-toggles {
  margin-top: 4px;
}

/* Range slider */
.range-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
}

.range-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.range-row input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}

.range-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent-blue);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--bg-sidebar);
}

/* Select / Dropdown */
.filter-select {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 12px;
  padding: 6px 8px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}

.filter-select:focus { border-color: var(--border-focus); }
.filter-select option { background: var(--bg-card); color: var(--text); }

/* ---- Main area ---- */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  min-height: 0;
  height: 100%;
}

/* ---- View tab bar ---- */
.view-tabs {
  position: relative;
  z-index: 15;
  display: flex;
  justify-content: center;
  gap: 2px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  flex-shrink: 0;
}

.view-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 200ms ease;
  letter-spacing: .01em;
  white-space: nowrap;
}

.view-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .04);
}

.view-tab.active {
  color: var(--bg-deep);
  background: var(--accent-gold);
  font-weight: 600;
}

/* ---- Canvas area (graph + constellation) ---- */
.canvas-area {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: var(--bg-deep);
}

.canvas-area svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ---- View containers ---- */
.view-container {
  flex: 1;
  position: relative;
  opacity: 0;
  pointer-events: none;
  transition: opacity 350ms ease;
  display: none;
  min-height: 0;
}

.view-container.active {
  opacity: 1;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
}

#graphView { z-index: 1; }
#galleryView { z-index: 1; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
#constellationView { z-index: 1; }
#heatmapView { z-index: 1; }

#galleryView::-webkit-scrollbar { width: 6px; }
#galleryView::-webkit-scrollbar-track { background: transparent; }
#galleryView::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---- Gallery view ---- */
.gallery-wrap {
  padding: 56px 24px 24px;
}

.gallery-section {
  margin-bottom: 32px;
}

.gallery-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 0 4px;
  cursor: pointer;
  user-select: none;
}

.gallery-section-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .01em;
}

.gallery-section-header .count {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 400;
}

.gallery-section-header .chevron {
  margin-left: auto;
  color: var(--text-dim);
  transition: transform 200ms ease;
  font-size: 14px;
}

.gallery-section.collapsed .chevron {
  transform: rotate(-90deg);
}

.gallery-section.collapsed .gallery-category-group,
.gallery-section.collapsed .gallery-scroll {
  display: none;
}

/* Category subgroup */
.gallery-category-group {
  margin-bottom: 20px;
}

.gallery-category-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  padding: 0 4px;
  margin-bottom: 10px;
  font-weight: 500;
}

/* Horizontal scroll row */
.gallery-scroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px 16px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  -webkit-overflow-scrolling: touch;
}

.gallery-scroll::-webkit-scrollbar { height: 4px; }
.gallery-scroll::-webkit-scrollbar-track { background: transparent; }
.gallery-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Poster card */
.poster-card {
  flex-shrink: 0;
  width: 160px;
  scroll-snap-align: start;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 250ms ease, box-shadow 250ms ease;
  background: var(--bg-card);
}

.poster-card:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .6);
  z-index: 2;
}

.poster-card .poster-img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
  background: var(--bg-card);
}

.poster-card .poster-placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 10px;
}

.poster-card .poster-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 10px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .85));
  pointer-events: none;
}

.poster-card .poster-title {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.poster-card .poster-sub {
  font-size: 10px;
  color: rgba(255, 255, 255, .55);
  margin-top: 2px;
}

/* Rating badge on poster */
.poster-card .poster-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 26px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--bg-deep);
  pointer-events: none;
  padding: 0 6px;
  white-space: nowrap;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* Poster tags (genre, type) */
.poster-tag {
  display: inline-block;
  font-size: 8px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255,255,255,.1);
  color: #ccc;
  margin-right: 3px;
  margin-top: 3px;
}
.poster-tag.type-tag {
  background: rgba(96,165,250,.2);
  color: #60a5fa;
}

/* Hover info */
.poster-card .poster-hover-info {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 15, .88);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px 12px;
  opacity: 0;
  transition: opacity 200ms ease;
  text-align: center;
  pointer-events: none;
}

.poster-card:hover .poster-hover-info {
  opacity: 1;
}

.poster-hover-info .phi-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.3;
}

.poster-hover-info .phi-meta {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ---- Tooltip ---- */
.tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12px;
  z-index: 100;
  opacity: 0;
  transition: opacity 150ms ease;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  max-width: 240px;
  backdrop-filter: blur(12px);
}

.tooltip.visible { opacity: 1; }

.tooltip .tt-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
}

.tooltip .tt-badge {
  display: inline-block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 2px 6px;
  border-radius: 3px;
  margin-bottom: 6px;
  font-weight: 600;
}

.tooltip .tt-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.6;
}

.tooltip .tt-row span:last-child { color: var(--text); font-weight: 500; }

/* ---- Detail panel ---- */
.detail-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100%;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  z-index: 50;
  transform: translateX(-100%);
  transition: transform var(--transition);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.detail-panel.open { transform: translateX(0); }

.detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 150ms, background 150ms;
  z-index: 1;
}

.detail-close:hover { color: var(--text); background: var(--bg-card); }

.detail-poster {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  display: block;
}

.detail-poster.no-poster {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 11px;
  aspect-ratio: 2/3;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.detail-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.detail-scroll::-webkit-scrollbar { width: 5px; }
.detail-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.detail-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}

.detail-subtitle {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.detail-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.detail-meta .meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.detail-meta .meta-row .meta-key { color: var(--text-muted); }
.detail-meta .meta-row .meta-val { color: var(--text); font-weight: 500; }

.detail-connections h4 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.detail-connections ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-connections li {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-connections li .conn-label { color: var(--text); font-weight: 500; }
.detail-connections li .conn-rel {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-dim);
}

/* ---- Legend ---- */
.legend {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: rgba(17, 17, 24, .88);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 11px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 130px;
  transition: opacity 350ms ease;
}

.legend h4 {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 2px;
}

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

.legend-icon {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}

.legend-icon.circle { border-radius: 50%; }
.legend-icon.circle-ring { border-radius: 50%; border: 2px solid; background: transparent !important; }
.legend-icon.diamond { border-radius: 1px; transform: rotate(45deg); width: 8px; height: 8px; }
.legend-icon.rect { border-radius: 2px; }
.legend-icon.triangle {
  width: 0; height: 0;
  background: none !important;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 9px solid var(--accent-green);
}

/* ---- SVG nodes ---- */
.node { cursor: grab; }
.node:active { cursor: grabbing; }
.node-shape { transition: opacity var(--transition), filter var(--transition), r var(--transition); }
.link-line { transition: opacity var(--transition), stroke-opacity var(--transition); }

.node-label {
  font-family: var(--font);
  font-size: 10px;
  fill: var(--text);
  text-anchor: middle;
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms ease;
}

.node:hover .node-label,
.node.highlighted .node-label { opacity: 1; }

/* Dimmed state */
.dimmed .node { opacity: 0.08; }
.dimmed .node.highlighted { opacity: 1; }
.dimmed .node.hovered { opacity: 1; }
.dimmed .node-shape-inner { opacity: 0.04; }
.dimmed .link-line { opacity: 0.04; }
.dimmed .highlighted .node-shape-inner { opacity: 0.4; }
.dimmed .highlighted .node-label { opacity: 1; }
.dimmed .link-line.highlighted { opacity: 0.8; }

/* Constellation-specific dimmed */
.dimmed .constellation-poster { opacity: 0.1; }
.dimmed .highlighted .constellation-poster { opacity: 1; }
.dimmed .constellation-label-bg { opacity: 0.1; }
.dimmed .highlighted .constellation-label-bg { opacity: 0.7; }
.dimmed .constellation-label-text { opacity: 0.1; }
.dimmed .highlighted .constellation-label-text { opacity: 1; }

/* Glow filter on hover */
.node.hovered .node-shape {
  filter: url(#glow);
}

/* Constellation poster hover */
.constellation-poster {
  transition: transform 200ms ease, opacity var(--transition);
}

/* Stats bar */
.stats-bar {
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-dim);
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
}

/* Loading state */
.loading-msg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-dim);
  font-size: 13px;
  letter-spacing: .02em;
}

.loading-msg::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  margin-left: 8px;
  vertical-align: middle;
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
}

.empty-state p { margin-top: 6px; font-size: 11px; }

/* Gallery empty */
.gallery-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  font-size: 13px;
}

/* ---- Heatmap view ---- */
.heatmap-controls {
  position: absolute;
  top: 56px;
  left: 16px;
  z-index: 10;
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(17, 17, 24, .75);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
}

.heatmap-control-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: .02em;
  white-space: nowrap;
}

.heatmap-controls .filter-select {
  min-width: 90px;
}

#heatmapView .canvas-area {
  padding-top: 0;
}

.tt-movies {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text);
  max-height: 160px;
  overflow-y: auto;
}

.tt-movies em {
  color: var(--text-dim);
}

/* ---- View info bar ---- */
.view-info {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: 500px;
}

.info-toggle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--border-focus);
  background: rgba(17, 17, 24, .85);
  backdrop-filter: blur(12px);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 200ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.info-toggle:hover {
  color: var(--text);
  border-color: var(--accent-blue);
  background: rgba(26, 26, 37, .95);
}

.view-info.expanded .info-toggle {
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

.info-brief {
  display: none;
}

.info-detail {
  display: none;
  background: rgba(17, 17, 24, .92);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-muted);
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  max-width: 500px;
}

.view-info.expanded .info-detail {
  display: block;
}

.info-detail p {
  margin-bottom: 8px;
}

.info-detail p:last-child {
  margin-bottom: 0;
}

.info-detail strong {
  color: var(--text);
  font-weight: 600;
}

.detail-description {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.detail-description p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.detail-source {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Bubble filter sections */
.bubble-filter-section .bubble-filter-content {
  display: none;
}
.bubble-filter-section:not(.collapsed) .bubble-filter-content {
  display: block;
}
.bubble-filter-header {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.bubble-chevron {
  font-size: 10px;
  color: var(--text-dim);
  transition: transform 200ms;
}
.bubble-filter-section:not(.collapsed) .bubble-chevron {
  transform: rotate(90deg);
}
.bubble-filter-controls {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.bf-all, .bf-none {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font);
}
.bf-all:hover, .bf-none:hover {
  color: var(--text);
  border-color: var(--border-focus);
}
.bubble-select {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.bubble-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--font);
  transition: all 150ms;
  white-space: nowrap;
}
.bubble-btn.active {
  background: rgba(96, 165, 250, .15);
  border-color: rgba(96, 165, 250, .4);
  color: var(--text);
}
.bubble-btn:hover {
  border-color: var(--accent-blue);
}
.bubble-count {
  font-size: 8px;
  opacity: 0.5;
  margin-left: 2px;
}

/* Year histogram */
.year-histogram {
  margin-bottom: 6px;
}
.histogram-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 32px;
}
.hist-bar {
  flex: 1;
  background: rgba(96, 165, 250, .3);
  border-radius: 2px 2px 0 0;
  min-width: 4px;
  transition: background 150ms;
}
.hist-bar:hover {
  background: rgba(96, 165, 250, .6);
}
