/* cw-tools external D3 renderer stylesheet */

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: system-ui, sans-serif;
}

body {
  position: relative;
}

#emit-graph,
#graph,
svg.graph {
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
}

#emit-controls {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10;
  box-sizing: border-box;
  width: min(21rem, calc(100vw - 1.5rem));
  padding: 0.75rem 0.85rem 0.8rem;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(3px);
}

#emit-control-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.15rem;
}

#emit-z-value {
  font-size: 1.05rem;
  font-weight: 700;
}

#emit-z-count {
  font-size: 0.78rem;
  color: #555;
  text-align: right;
}

#emit-z-distribution {
  display: block;
  width: 20rem;
  height: 20rem;
  margin: 0 auto;
  overflow: visible;
}

.emit-distribution-base {
  fill: rgba(90, 90, 90, 0.22);
  stroke: rgba(50, 50, 50, 0.48);
  stroke-width: 1;
}

.emit-distribution-selected {
  fill: rgba(30, 100, 170, 0.58);
  stroke: rgba(20, 75, 130, 0.88);
  stroke-width: 1;
}

.emit-distribution-axis {
  stroke: #555;
  stroke-width: 1;
}

.emit-distribution-threshold {
  stroke: #111;
  stroke-width: 1.4;
  stroke-dasharray: 4 3;
  pointer-events: none;
}

.emit-distribution-label {
  fill: #555;
  font-size: 11px;
}

.emit-distribution-zero {
  stroke: #7a668f;
  stroke-width: 1;
  stroke-dasharray: 3 3;
  pointer-events: none;
}

.emit-distribution-smooth {
  fill: none;
  stroke: #444;
  stroke-width: 1.2;
  pointer-events: none;
}

#emit-slider-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

#emit-z-slider {
  width: 100%;
  margin: 0;
}

#emit-z-min,
#emit-z-max {
  display: none;
  min-width: 2.5em;
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  color: #555;
}

#emit-z-max {
  text-align: right;
}

#emit-z-reset,
#emit-reheat,
#emit-source-close {
  padding: 0.2rem 0.55rem;
  border: 1px solid #999;
  border-radius: 0.35rem;
  background: #fff;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

#emit-z-reset:hover,
#emit-reheat:hover,
#emit-source-close:hover {
  background: #f2f2f2;
}

.edge .edge-line {
  stroke: #000;
  stroke-width: 0.1;
}

.edge .edge-hit {
  stroke: transparent;
  stroke-width: 12;
  pointer-events: stroke;
  cursor: pointer;
}

.edge .edge-label {
  display: none;
  font-size: 6px;
  dominant-baseline: middle;
}

.node text {
  pointer-events: none;
}

#emit-arrow path {
  fill: #777;
}

#emit-tip,
#tip {
  position: fixed;
  z-index: 20;
  display: none;
  max-width: 34rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #aaa;
  border-radius: 0.35rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  font-size: 0.85rem;
  white-space: pre-wrap;
  pointer-events: none;
}

#emit-source-panel {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 15;
  box-sizing: border-box;
  width: min(34rem, calc(100vw - 1.5rem));
  max-height: calc(100vh - 1.5rem);
  overflow: auto;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 0.55rem;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(3px);
}

#emit-source-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.14);
  background: rgba(255, 255, 255, 0.98);
}

#emit-source-content {
  padding: 0.15rem 0.75rem 0.75rem;
}

.emit-source-record {
  padding: 0.7rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.emit-source-record:last-child {
  border-bottom: 0;
}

.emit-source-unit-id {
  margin-bottom: 0.25rem;
  color: #666;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
}

.emit-source-field {
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.emit-source-field-surface {
  font-size: inherit;
}

.emit-source-field-name {
  color: #666;
  font-size: 0.78rem;
}

.emit-source-missing,
.emit-source-error {
  color: #666;
  font-size: 0.85rem;
}

.node.font-rank-0 text {
  opacity: 0.55;
  font-weight: 400;
}
.node.font-rank-1 text {
  opacity: 0.6;
  font-weight: 400;
}
.node.font-rank-2 text {
  opacity: 0.65;
  font-weight: 400;
}
.node.font-rank-3 text {
  opacity: 0.7;
  font-weight: 400;
}
.node.font-rank-4 text {
  opacity: 0.75;
  font-weight: 400;
}
.node.font-rank-5 text {
  opacity: 0.8;
  font-weight: 500;
}
.node.font-rank-6 text {
  opacity: 0.85;
  font-weight: 500;
}
.node.font-rank-7 text {
  opacity: 0.9;
  font-weight: 600;
}
.node.font-rank-8 text {
  opacity: 0.95;
  font-weight: 700;
}
.node.font-rank-9 text {
  opacity: 1;
  font-weight: 700;
}

.node circle {
  fill: #fff;
  stroke: #000;
  stroke-width: 0.1;
}

.edge.z-negative .edge-line {
  stroke-dasharray: 5 3;
}

.edge.z-zero .edge-line {
  stroke-dasharray: 1 3;
}

.has-url {
  cursor: pointer;
}
.is-hidden {
  display: none;
}

@media (max-width: 42rem) {
  #emit-controls {
    top: 0.4rem;
    left: 0.4rem;
    width: calc(100vw - 0.8rem);
  }

  #emit-source-panel {
    top: 0.4rem;
    right: 0.4rem;
    width: calc(100vw - 0.8rem);
    max-height: calc(100vh - 0.8rem);
  }

  #emit-z-distribution {
    height: 5.5rem;
  }

  #emit-z-count {
    font-size: 0.7rem;
  }
}

#emit-command-panel {
  box-sizing: border-box;
  max-width: min(72rem, calc(100vw - 2rem));
  max-height: 12rem;
  margin: 0.75rem auto 0;
  padding: 0.75rem 1rem;

  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;

  border: 1px solid;
  border-radius: 0.5rem;
  background: rgba(127, 127, 127, 0.08);

  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.45;
}

#emit-button-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}
