/* Network graph explorer — Hyperstack tokens, theme-aware, no CDNs. */
:root {
  --bg:#fff; --fg:#0f172a; --muted:#475569; --surface:#f1f5f9; --panel:#fff; --border:#e2e8f0; --inset:#f8fafc;
  --primary:#2563eb; --primary-contrast:#fff; --good:#0f766e; --warn:#b45309; --bad:#b91c1c; --edge:#94a3b8;
}
@media (prefers-color-scheme: dark) {
  :root { --bg:#0f172a; --fg:#f8fafc; --muted:#a5b1c2; --surface:#1e293b; --panel:#1e293b; --border:#334155; --inset:#0f172a;
    --primary:#60a5fa; --primary-contrast:#0b1220; --good:#2dd4bf; --warn:#fbbf24; --bad:#f87171; --edge:#64748b; }
}
[data-theme="light"] { --bg:#fff; --fg:#0f172a; --muted:#475569; --surface:#f1f5f9; --panel:#fff; --border:#e2e8f0; --inset:#f8fafc; --primary:#2563eb; --primary-contrast:#fff; --good:#0f766e; --warn:#b45309; --bad:#b91c1c; --edge:#94a3b8; }
[data-theme="dark"] { --bg:#0f172a; --fg:#f8fafc; --muted:#a5b1c2; --surface:#1e293b; --panel:#1e293b; --border:#334155; --inset:#0f172a; --primary:#60a5fa; --primary-contrast:#0b1220; --good:#2dd4bf; --warn:#fbbf24; --bad:#f87171; --edge:#64748b; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: ui-sans-serif, system-ui, sans-serif; }
#app { padding: 20px; max-width: 920px; margin: 0 auto; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.hint { font-size: 14px; color: var(--muted); line-height: 1.55; margin: 0 0 16px; }
.hint b { color: var(--fg); }

.controls { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; margin-bottom: 16px; align-items: end; }
@media (max-width: 640px) { .controls { grid-template-columns: 1fr; } }
.sl { background: var(--inset); border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px; }
.sl label { font-size: 12px; color: var(--muted); font-weight: 700; display: flex; justify-content: space-between; align-items: baseline; }
.sl label b { color: var(--fg); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.sl input[type=range] { width: 100%; accent-color: var(--primary); margin-top: 8px; }
.toggle { background: var(--inset); border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--primary); }
.toggle span { font-size: 12.5px; font-weight: 700; color: var(--fg); }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 16px; }
@media (max-width: 560px) { .cards { grid-template-columns: 1fr 1fr; } }
.card { background: var(--panel); padding: 12px; text-align: center; }
.card .k { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.card .v { font-size: 22px; font-weight: 800; font-family: ui-monospace, monospace; margin-top: 4px; }
.card .v.dia { color: var(--warn); } .card .v.bis { color: var(--bad); }

.panel { background: var(--inset); border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.panel svg { width: 100%; height: auto; display: block; }

.edge { stroke: var(--edge); stroke-width: 2; fill: none; }
.edge.wrap { stroke-dasharray: 4 4; opacity: .8; }
.edge.dia { stroke: var(--warn); stroke-width: 4; opacity: 1; }
.edge.cut { stroke: var(--bad); stroke-width: 4; opacity: 1; }
.cutline { stroke: var(--bad); stroke-width: 1.5; stroke-dasharray: 6 5; opacity: .7; }
.node { fill: var(--primary); stroke: var(--panel); stroke-width: 2; }
.node.end { fill: var(--warn); }

.legend { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend .it { display: flex; align-items: center; gap: 6px; }
.legend .sw { width: 16px; height: 3px; border-radius: 2px; }
.legend .sw.dia { background: var(--warn); } .legend .sw.cut { background: var(--bad); } .legend .sw.edge { background: var(--edge); }

.note { font-size: 14px; line-height: 1.6; color: var(--muted); background: var(--surface); border-radius: 12px; padding: 14px 16px; border-left: 4px solid var(--primary); }
.note b { color: var(--fg); } .note .dia { color: var(--warn); font-weight: 700; } .note .cut { color: var(--bad); font-weight: 700; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
