/* styles.css -- local styles. lib/tokens.css (vendored from mercs2-tools-shared) supplies the shared
   neutrals; this defines this tool's own accent, same convention as every other tool in the ecosystem. */

:root {
  --accent:      #ff6b9d;
  --accent-soft: rgba(255, 107, 157, 0.12);
  --accent-line: rgba(255, 107, 157, 0.35);
  --accent-ink:  #2a0f18;

  /* not yet folded into lib/tokens.css -- same local-until-shared status as mercs2-webtool-template's copy */
  --ok:   #4ade80;
  --warn: #fbbf24;
  --bad:  #f87171;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font-sans); overflow: hidden; }

.app { display: flex; height: 100%; }

.canvaswrap { flex: 1 1 auto; position: relative; min-width: 0; }
#graphcanvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---------- left sidebar: node library ---------- */
.library {
  flex: none;
  width: 260px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--bg-elev);
  overflow: hidden;
}
.library header { padding: 14px 14px 10px; border-bottom: 1px solid var(--line); }
.library header h1 { margin: 0 0 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint); }
.library .count { margin: 6px 0 0; font-size: 11px; color: var(--text-faint); }
#paletteSearch {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  font: 12.5px var(--font-sans);
}
#paletteSearch:focus { outline: none; border-color: var(--accent-line); }

.legend {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  color: var(--text-muted);
}
.legend div { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.legend p { margin: 8px 0 0; color: var(--text-faint); line-height: 1.5; }
.swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.swatch.exec { background: #aa8866; }
.swatch.num  { background: #aaaaaa; border-radius: 50%; }
.swatch.str  { background: #ddccaa; border-radius: 50%; }

#palette { flex: 1 1 auto; overflow-y: auto; padding: 4px 0 14px; }
#palette details { border-bottom: 1px solid var(--line); }
#palette summary {
  padding: 8px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  list-style: none;
}
#palette summary::-webkit-details-marker { display: none; }
#palette summary::before { content: "\25B8  "; color: var(--text-faint); }
#palette details[open] summary::before { content: "\25BE  "; }
#palette ul { list-style: none; margin: 0; padding: 0 0 8px; }
#palette li {
  padding: 5px 14px 5px 30px;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
}
#palette li:hover { background: var(--accent-soft); color: var(--accent); }
#palette p.empty { padding: 14px; color: var(--text-faint); font-size: 12px; font-style: italic; }

.side {
  flex: none;
  width: 380px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--bg-elev);
}
.side header { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.side header h1 { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.side header p { margin: 0; color: var(--text-faint); font-size: 11.5px; }

.side .samples { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.side .samples label { display: block; font-size: 11px; color: var(--text-faint); margin-bottom: 5px; }
.side .samples select {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  font: 12.5px var(--font-sans);
}
.side .samples select:focus { outline: none; border-color: var(--accent-line); }
.side .samples .hint { margin: 7px 0 0; color: var(--text-faint); font-size: 11px; line-height: 1.4; }

.side .live { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.live-row { display: flex; align-items: center; gap: 9px; }
.side .live .hint { margin: 8px 0 0; color: var(--text-faint); font-size: 11px; line-height: 1.4; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-faint); flex: none; }
.dot.connecting { background: var(--warn); }
.dot.open { background: var(--ok); }
.dot.closed, .dot.error { background: var(--bad); }
.statustext { font-size: 12px; color: var(--text-muted); flex: 1 1 auto; }

.side .actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
button {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm);
  padding: 7px 13px;
  font: 600 13px var(--font-sans);
  cursor: pointer;
}
button:hover { background: var(--accent-line); }
button:disabled { opacity: 0.4; cursor: default; background: var(--accent-soft); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:hover:not(:disabled) { filter: brightness(1.08); }

#status { padding: 0 16px 10px; color: var(--text-muted); font-size: 11.5px; }

#code {
  flex: 1 1 auto;
  margin: 0 16px 16px;
  padding: 12px 14px;
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: 12px/1.6 var(--font-mono);
  color: var(--text-muted);
  white-space: pre;
}
