:root {
  --header-h: 60px;
  --sidebar-w: 360px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
  color: var(--text);
  background: var(--bg);
  display: grid;
  grid-template-columns: 1fr var(--sidebar-w);
  grid-template-rows: var(--header-h) 1fr;
  grid-template-areas: "header header" "graph sidebar";
  height: 100vh;
  overflow: hidden; /* let the graph area manage pan/zoom; sidebar scrolls */
}
header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
h1 {
  font-size: 16px;
  margin: 0 0 2px 0;
}
.muted {
  color: var(--muted);
  font-size: 12px;
}
#cy {
  grid-area: graph;
  background: var(--surface);
  height: calc(100vh - var(--header-h));
  width: 100%;
  border-right: 1px solid var(--border);
  /* NOTE: cytoscape handles pan/zoom; no need for scrollbars here */
}
aside {
  grid-area: sidebar;
  background: var(--surface);
  height: calc(100vh - var(--header-h));
  overflow: auto;
  padding: 12px 14px;
  border-left: 1px solid var(--border);
}
.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  font-size: 12px;
  margin-right: 6px;
}
.kw {
  display: inline-block;
  margin: 2px 6px 2px 0;
  padding: 2px 8px;
  background: var(--accent-soft);
  border-radius: 999px;
  font-size: 12px;
}
.section-title {
  font-weight: 600;
  margin: 12px 0 6px;
}
.stat {
  margin: 6px 0;
}
button {
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  cursor: pointer;
}
input[type="range"] {
  width: 200px;
}

button {
  color: var(--text);
}
#selTitle,
#selStats {
  overflow-wrap: anywhere;
}
@media (max-width: 1200px) {
  :root {
    --header-h: 115px;
  }
  header {
    flex-wrap: wrap;
  }
}
@media (max-width: 720px) {
  body {
    display: block;
    height: auto;
    overflow: auto;
  }
  header {
    min-height: 130px;
  }
  #cy {
    height: 55vh;
    min-height: 350px;
  }
  aside {
    height: auto;
    border-top: 1px solid var(--border);
  }
  input[type="range"] {
    width: 150px;
  }
}
