:root{
  --bg: #0b1020;
  --panel: rgba(255,255,255,0.06);
  --panel2: rgba(255,255,255,0.08);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.70);
  --muted2: rgba(255,255,255,0.55);
  --border: rgba(255,255,255,0.12);
  --accent: #8ab4ff;
  --bar: #3b82f6; /* blue relevance bar */
  --shadow: 0 12px 30px rgba(0,0,0,0.35);
  --radius: 16px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

*{ box-sizing: border-box; }
html,body{ height:100%; margin:0; background: var(--bg); color: var(--text); font-family: var(--sans); }

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

.header{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  padding: 18px 18px 12px 18px;
  gap: 14px;
  border-bottom: 1px solid var(--border);
}

.title h1{ margin:0; font-size: 20px; letter-spacing: 0.2px; }
.subtitle{ margin-top: 6px; font-size: 13px; color: var(--muted); max-width: 740px; }

.header-actions{
  display:flex; gap: 12px; align-items:center;
}

.search{ display:flex; gap: 8px; align-items:center; }
.search input{
  width: 320px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  outline: none;
}
.search input::placeholder{ color: rgba(255,255,255,0.45); }

button{
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.10);
  color: var(--text);
  cursor:pointer;
}
button:hover{ background: rgba(255,255,255,0.14); }
button.secondary{ background: transparent; border: 1px solid rgba(255,255,255,0.18); }

.mode-select{
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.10);
  color: var(--text);
  outline: none;
}

.main{
  flex:1;
  display:grid;
  grid-template-columns: 300px 1fr 360px;
  gap: 12px;
  padding: 12px 12px 12px 12px;
}

.panel{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  overflow: auto;
}

.panel h2{
  margin: 0 0 12px 0;
  font-size: 14px;
  letter-spacing: 0.3px;
  color: rgba(255,255,255,0.92);
}

.block{ margin: 12px 0; }
.block.small{ margin: 10px 0; }

.label{ font-size: 12px; color: var(--muted); display:block; margin-bottom: 8px; }
.row{ display:flex; align-items:center; gap: 10px; }
.hint{ font-size: 12px; color: var(--muted2); margin-top: 6px; line-height: 1.35; }

.pill{
  display:inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.07);
  font-family: var(--mono);
  font-size: 12px;
}

.checkboxes{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  font-size: 13px;
  color: var(--muted);
}
.checkboxes input{ transform: translateY(1px); }

.canvas{
  position: relative;
  background: rgba(0,0,0,0.14);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}

#cy{ width:100%; height:100%; min-height: 680px; }

.loading{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 14px;
  color: var(--muted);
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(2px);
}

.tooltip{
  position:absolute;
  pointer-events:none;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(20,24,40,0.92);
  box-shadow: var(--shadow);
  font-size: 12px;
  color: var(--text);
  max-width: 280px;
}
.hidden{ display:none; }

.detail{
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  padding: 12px;
}
.detail.empty{ color: var(--muted); }

.kv{
  display:grid;
  grid-template-columns: 120px 1fr;
  gap: 6px 10px;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 8px;
}
.kv .k{ color: rgba(255,255,255,0.78); }
.kv .v{ color: rgba(255,255,255,0.92); word-break: break-word; }

.section-title{
  margin-top: 12px;
  font-size: 12px;
  color: rgba(255,255,255,0.80);
  letter-spacing: 0.2px;
}

.badges{
  display:flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.badge{
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.07);
  font-size: 12px;
  color: rgba(255,255,255,0.86);
}

.bar-row{
  display:grid;
  grid-template-columns: 1fr 44px;
  gap: 10px;
  align-items:center;
  margin-top: 8px;
}
.bar{
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.14);
  overflow:hidden;
}
.bar > span{
  display:block;
  height:100%;
  background: var(--bar);
  width: 0%;
}
.bar-val{
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(255,255,255,0.80);
  text-align:right;
}

.stats{
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.footer{
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  color: var(--muted2);
  font-size: 12px;
}

.citebox{ padding: 10px; }
.cite-title{
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  margin-bottom: 8px;
}
.cite-text{
  font-size: 11px;     /* smaller, less obtrusive */
  line-height: 1.35;
  color: rgba(255,255,255,0.70);
}
.cite-links{
  margin-top: 8px;
  font-size: 11px;
}
.cite-links a{
  color: rgba(170, 205, 255, 0.95);
  text-decoration: none;
}
.cite-links a:hover{ text-decoration: underline; }
.sep{ margin: 0 6px; color: rgba(255,255,255,0.35); }
.cite-note{
  margin-top: 8px;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
}
/* =========================================================
   Layout/scroll fixes (append at END of style.css)
   ========================================================= */

/* Prevent the whole page from scrolling */
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

/* Make app fill viewport and keep main area fixed */
.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* IMPORTANT: allow flex children to shrink for overflow to work */
.main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* Panels should scroll internally */
.panel {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Canvas area should never scroll (only cy zoom/pan) */
.canvas {
  min-height: 0;
  overflow: hidden;
}

#cy {
  width: 100%;
  height: 100%;
}

/* Right panel detail typography */
#detailBox {
  padding: 0;
}

.detail-card {
  padding: 14px;
  font-size: 13px;
  line-height: 1.35;
}

.detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.detail-title {
  font-size: 18px;
  font-weight: 800;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
}

.section {
  margin-top: 12px;
}

.section-title {
  font-size: 12px;
  opacity: 0.85;
  margin-bottom: 8px;
  font-weight: 600;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
}

/* Key-value rows */
.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0;
}

.kv .k {
  opacity: 0.85;
}

.kv .v {
  font-weight: 600;
  white-space: nowrap;
  text-align: right;
}

/* Dimension cards */
.dim-card {
  margin-top: 10px;
}

.dim-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.dim-name {
  font-weight: 700;
}

.dim-val {
  opacity: 0.9;
  white-space: nowrap;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  overflow: hidden;
  margin-top: 6px;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: #6aa9ff; /* force pretty blue */
}

.dim-sub {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.85;
}

.muted {
  opacity: 0.75;
}


/* =========================================================
   Dual-handle range slider (two <input type="range"> on one axis)
   ========================================================= */
.dual-range{
  position: relative;
  flex: 1 1 auto;
  height: 22px;
}

/* Stack both sliders on the same track */
.dual-range input[type="range"]{
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 22px;
  margin: 0;
  background: transparent;
  pointer-events: none; /* allow clicks to pass through except thumbs */
}

/* Re-enable pointer events on thumbs so users can drag them */
.dual-range input[type="range"]::-webkit-slider-thumb{ pointer-events: auto; }
.dual-range input[type="range"]::-moz-range-thumb{ pointer-events: auto; }

/* Keep the min thumb above the max thumb */
.dual-range .range-min{ z-index: 3; }
.dual-range .range-max{ z-index: 2; }

/* Show only ONE track (use the max slider's track; hide the min slider's track) */
.dual-range .range-min::-webkit-slider-runnable-track{ background: transparent; }
.dual-range .range-min::-moz-range-track{ background: transparent; }



/* =========================================================
   Toggle + range label typography (match "Show edge weights")
   ========================================================= */
.toggle-label{
  font-size: 13px;
  font-weight: 400;
  line-height: 1.25;
  color: var(--muted);
}
.toggle-label input[type="checkbox"]{
  transform: translateY(1px);
  margin-right: 8px;
}

/* Valence range (two sliders: Min/Max) */
.range-grid{
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
.range-row{
  display: flex;
  align-items: center;
  gap: 10px;
}
.range-label{
  width: 36px;
  flex: 0 0 36px;
}
.range-row input[type="range"]{
  flex: 1 1 auto;
  min-width: 0;
}
