/* ================================================================== */
/*  D3 Graph Viewer — Stylesheet                                     */
/* ================================================================== */

:root {
  --bg:           #0f172a;
  --bg-surface:   #1e293b;
  --bg-hover:     #334155;
  --text:         #e2e8f0;
  --text-muted:   #94a3b8;
  --border:       #334155;
  --accent:       #818cf8;
  --sidebar-w:    340px;
  --stats-h:      42px;
}

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

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* ------------------------------------------------------------------ */
/*  Layout                                                             */
/* ------------------------------------------------------------------ */

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

#stats-bar {
  height: var(--stats-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  font-size: 13px;
  overflow-x: auto;
  flex-shrink: 0;
}

#main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

#graph-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  pointer-events: none;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

#sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  transition: width 0.2s ease, border-left-width 0.2s ease, visibility 0s linear 0.2s;
}

#sidebar.collapsed {
  width: 0;
  border-left: 0;
  visibility: hidden;
  transition: width 0.2s ease, border-left-width 0.2s ease, visibility 0s;
}

/* ------------------------------------------------------------------ */
/*  Sidebar toggle (hamburger)                                         */
/* ------------------------------------------------------------------ */

.sidebar-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 15;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.5);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.2s, background 0.2s;
  padding: 0;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
  opacity: 1;
  background: rgba(30, 41, 59, 0.85);
  color: var(--text);
}

.sidebar-toggle .x-line { display: block; }
.sidebar-toggle .hamburger-line { display: none; }

.sidebar-toggle.collapsed .x-line { display: none; }
.sidebar-toggle.collapsed .hamburger-line { display: block; }

/* ------------------------------------------------------------------ */
/*  Pause/resume overlay                                               */
/* ------------------------------------------------------------------ */

.pause-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 15;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.5);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.2s, background 0.2s;
  padding: 0;
}

.pause-overlay:hover,
.pause-overlay:focus-visible {
  opacity: 1;
  background: rgba(30, 41, 59, 0.85);
  color: var(--text);
}

.pause-overlay.paused {
  opacity: 0.7;
  background: rgba(30, 41, 59, 0.7);
}

.pause-overlay.paused:hover {
  opacity: 1;
}

.pause-overlay .play-arrow { display: none; }
.pause-overlay .pause-bar { display: block; }

.pause-overlay.paused .play-arrow { display: block; }
.pause-overlay.paused .pause-bar { display: none; }

/* ------------------------------------------------------------------ */
/*  Drop zone                                                          */
/* ------------------------------------------------------------------ */

#drop-zone {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  cursor: pointer;
  z-index: 10;
  background: var(--bg);
}

#drop-zone .drop-icon {
  font-size: 48px;
  color: var(--text-muted);
}

#drop-zone .drop-text {
  font-size: 18px;
  color: var(--text-muted);
}

#drop-zone .drop-hint {
  font-size: 13px;
  color: var(--text-muted);
}

#drop-zone.drag-over {
  background: rgba(99, 102, 241, 0.1);
  border: 2px dashed var(--accent);
}

#drop-zone .drop-error {
  max-width: 480px;
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.45);
  border-radius: 8px;
  color: #fca5a5;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  cursor: default;
  display: flex;
  align-items: center;
  gap: 12px;
}

#drop-zone-error-text {
  flex: 1;
}

#drop-zone-error-dismiss {
  background: none;
  border: none;
  color: #fca5a5;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

#drop-zone-error-dismiss:hover,
#drop-zone-error-dismiss:focus-visible {
  background: rgba(239, 68, 68, 0.2);
  color: #fecaca;
}

.hidden {
  display: none !important;
}
/* ------------------------------------------------------------------ */

.stat-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* ------------------------------------------------------------------ */
/*  Sidebar sections                                                   */
/* ------------------------------------------------------------------ */

.sidebar-section {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-section .sidebar-heading {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  font-weight: 600;
}

.sidebar-section .sidebar-heading:hover {
  color: var(--text);
}

.sidebar-section .sidebar-heading::before {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform 0.15s;
  flex-shrink: 0;
}

.sidebar-section.collapsed .sidebar-heading {
  margin-bottom: 0;
}

.sidebar-section.collapsed .sidebar-heading::before {
  transform: rotate(-90deg);
}

.sidebar-section-body {
  overflow: hidden;
}

.sidebar-section.collapsed .sidebar-section-body {
  display: none;
}

/* ------------------------------------------------------------------ */
/*  Search                                                             */
/* ------------------------------------------------------------------ */

#search-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

#search-input:focus {
  border-color: var(--accent);
}

#search-results {
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 4px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
}

.search-result-item:hover,
.search-result-item.active {
  background: var(--bg-hover);
}

.search-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-type {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ------------------------------------------------------------------ */
/*  Sidebar actions                                                    */
/* ------------------------------------------------------------------ */

.sidebar-actions {
  display: flex;
  gap: 8px;
}

.action-btn {
  flex: 1;
  padding: 6px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.action-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.action-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.reset-forces-btn {
  margin-top: 8px;
  padding-left: 16px;
  padding-right: 16px;
}

.action-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.action-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.action-toggle input[type="checkbox"] {
  accent-color: var(--accent);
}

/* ------------------------------------------------------------------ */
/*  Type filters                                                       */
/* ------------------------------------------------------------------ */

.filter-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  padding: 3px 0;
}

.filter-item input[type="checkbox"] {
  accent-color: var(--accent);
}

.filter-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--border);
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-appearance: none;
  appearance: none;
  background: none;
}

.filter-color::-webkit-color-swatch-wrapper {
  padding: 0;
}

.filter-color::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

.filter-color::-moz-color-swatch {
  border: none;
  border-radius: 50%;
}

.filter-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.filter-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ */
/*  Edge legend                                                        */
/* ------------------------------------------------------------------ */

.edge-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 3px 0;
}

.edge-legend-swatch {
  width: 24px;
  height: 6px;
  flex-shrink: 0;
}

.edge-legend-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--border);
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-appearance: none;
  appearance: none;
  background: none;
}

.edge-legend-color::-webkit-color-swatch-wrapper {
  padding: 0;
}

.edge-legend-color::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

.edge-legend-color::-moz-color-swatch {
  border: none;
  border-radius: 50%;
}

.edge-legend-label {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edge-legend-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ */
/*  Attribute selectors                                                */
/* ------------------------------------------------------------------ */

.attr-selector-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.attr-selector-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 62px;
}

.attr-selector {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}

.attr-selector:focus {
  border-color: var(--accent);
}

.attr-selector option {
  background: var(--bg-surface);
  color: var(--text);
}

/* ------------------------------------------------------------------ */
/*  Rollup controls                                                    */
/* ------------------------------------------------------------------ */

.rollup-controls {
  margin-top: 4px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(129, 140, 248, 0.05);
}

.rollup-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}

.rollup-toggle input {
  accent-color: var(--accent);
  cursor: pointer;
}

.rollup-fn-row {
  margin-top: 8px;
  margin-bottom: 0;
}

/* ------------------------------------------------------------------ */
/*  Force controls                                                     */
/* ------------------------------------------------------------------ */

.force-control-row {
  margin-bottom: 10px;
}

.force-control-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3px;
}

.force-control-label {
  font-size: 12px;
  color: var(--text-muted);
}

.force-control-value {
  font-size: 11px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

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

.force-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-surface);
  cursor: pointer;
  transition: transform 0.1s;
}

.force-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.force-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-surface);
  cursor: pointer;
}

/* ------------------------------------------------------------------ */
/*  Colour legend                                                      */
/* ------------------------------------------------------------------ */

#color-legend {
  margin-top: 10px;
}

.legend-numeric {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.legend-scale-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.legend-scale-row .attr-selector {
  flex: 1;
}

.legend-gradient-bar {
  height: 14px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.legend-stops {
  display: flex;
  justify-content: space-between;
}

.legend-stop-picker {
  width: 16px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: none;
}

.legend-stop-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.legend-stop-picker::-webkit-color-swatch {
  border: none;
  border-radius: 2px;
}

.legend-stop-picker::-moz-color-swatch {
  border: none;
  border-radius: 2px;
}

.legend-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.legend-categorical {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.legend-cat-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-cat-picker {
  width: 16px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-appearance: none;
  appearance: none;
  background: none;
}

.legend-cat-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.legend-cat-picker::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

.legend-cat-picker::-moz-color-swatch {
  border: none;
  border-radius: 50%;
}

.legend-cat-label {
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/*  Detail modal (popped out over the graph)                           */
/* ------------------------------------------------------------------ */

#detail-modal {
  position: absolute;
  top: 60px;
  right: 16px;
  width: 340px;
  max-height: calc(100% - 72px);
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 25;
  overflow: hidden;
}

.detail-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.detail-modal-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.detail-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}

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

/* ------------------------------------------------------------------ */
/*  Help overlay button (bottom-left)                                  */
/* ------------------------------------------------------------------ */

.help-overlay {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 15;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.5);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.2s, background 0.2s;
  padding: 0;
}

.help-overlay:hover,
.help-overlay:focus-visible {
  opacity: 1;
  background: rgba(30, 41, 59, 0.85);
  color: var(--text);
}

/* ------------------------------------------------------------------ */
/*  Help modal (centered overlay dialog)                               */
/* ------------------------------------------------------------------ */

#help-modal {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.help-modal-content {
  position: relative;
  width: min(620px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.help-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.help-modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.help-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}

.help-modal-close:hover,
.help-modal-close:focus-visible {
  background: var(--bg-hover);
  color: var(--text);
}

.help-modal-body {
  overflow-y: auto;
  padding: 16px 20px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  outline: none;
}

.help-modal-body section {
  margin-bottom: 18px;
}

.help-modal-body section:last-child {
  margin-bottom: 0;
}

.help-modal-body h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
}

.help-modal-body p,
.help-modal-body li {
  color: var(--text-muted);
}

.help-modal-body ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.help-modal-body li {
  padding: 3px 0;
  padding-left: 14px;
  position: relative;
}

.help-modal-body li::before {
  content: '\2022';
  position: absolute;
  left: 0;
  color: var(--accent);
}

.help-modal-body strong {
  color: var(--text);
  font-weight: 600;
}

.help-modal-body code {
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
  color: var(--text);
}

.help-shortcut-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.help-shortcut-table th,
.help-shortcut-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.help-shortcut-table th {
  color: var(--text);
  font-weight: 600;
}

.help-shortcut-table td {
  color: var(--text-muted);
}

.help-shortcut-table td:last-child {
  text-align: right;
}

.help-shortcut-table kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  font-size: 11px;
  font-family: 'Inter', system-ui, monospace;
  color: var(--text);
}

/* ------------------------------------------------------------------ */
/*  Detail panel                                                       */
/* ------------------------------------------------------------------ */

#detail-panel {
  overflow-y: auto;
  padding: 16px;
  font-size: 13px;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.detail-header .detail-title {
  font-size: 16px;
  word-break: break-word;
}

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

.detail-meta {
  margin-bottom: 16px;
  line-height: 1.8;
}

.detail-meta code {
  font-size: 11px;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 3px;
  word-break: break-all;
}

.detail-section {
  margin-bottom: 16px;
}

.detail-section-heading {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.detail-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.detail-table td:first-child {
  font-weight: 600;
  white-space: nowrap;
  width: 1%;
}

.detail-table a {
  color: var(--accent);
  text-decoration: none;
}

.detail-table a:hover {
  text-decoration: underline;
}

.detail-edges {
  list-style: none;
}

.detail-edges li {
  padding: 3px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}

.edge-rel {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg);
  font-size: 11px;
  margin: 0 4px;
}

.detail-more {
  color: var(--text-muted);
  font-style: italic;
}

/* ------------------------------------------------------------------ */
/*  Tooltip                                                            */
/* ------------------------------------------------------------------ */

#tooltip {
  position: fixed;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  pointer-events: none;
  z-index: 100;
  max-width: 320px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.tooltip-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.tooltip-type {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.tooltip-detail {
  font-size: 12px;
  color: var(--text-muted);
}

.tooltip-hint {
  font-size: 11px;
  color: var(--accent);
  margin-top: 4px;
}

/* ------------------------------------------------------------------ */
/*  Utility                                                            */
/* ------------------------------------------------------------------ */

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Screen-reader-only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus-visible outlines for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#drop-zone:focus-visible {
  border-color: var(--accent);
  background: rgba(129, 140, 248, 0.08);
}
