/* Weave's look for weave.hexwork.co.uk (layout_weave.php): the Hexwork tools' dark family, as Sanctum. Brand red
   (#C8102E) and link pink (#FF4D6A) on near-black (#09070A), Syne for headings, Geist for text. Dark only, phone first:
   nothing scrolls sideways at 320px. The canvas editor (editor.js) fills the window on a desktop and stacks on a phone. */
:root {
  color-scheme: dark;
  --link: #FF4D6A;
  --link-hi: #FF7A90;
  --red: #C8102E;
  --red-deep: #A50D26;
  --ink: #F6F1F3;
  --muted: #ABA0A6;
  --paper: #09070A;
  --card: #110E13;
  --raised: #19141B;
  --rule: #2A222C;
  --rule-strong: #43374A;
  --ok: #4ADE80;
  --bad: #FF8A8A;
  --warn: #FBBF24;
  --display: "Syne", "Arial Black", system-ui, sans-serif;
  --body: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --focus: 0 0 0 2px var(--paper), 0 0 0 4px var(--link);
  --radius: 16px;
  /* One colour per tool, for the edge of its boxes and its tags. */
  --t-hexwork: #FF4D6A;
  --t-familiar: #A78BFA;
  --t-sigil: #F59E0B;
  --t-keep: #34D399;
  --t-discord: #8B9DFF;
  --t-weave: #F472B6;
  --t-logic: #94A3B8;
  --t-bulwark: #EF4444;
  --t-herald: #38BDF8;
  --t-banner: #FACC15;
  --t-bard: #2DD4BF;
  --t-slack: #E879F9;
  --t-mailchimp: #FDE047;
  --t-stripe: #818CF8;
  --t-google: #4ADE80;
  --t-xero: #22D3EE;
  --t-charm: #C084FC;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; font: 400 1rem/1.55 var(--body); color: var(--ink); background: var(--paper); overflow-x: hidden; }
img, svg { max-width: 100%; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--link-hi); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.1; letter-spacing: -0.01em; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); overflow-wrap: anywhere; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 40; padding: 8px 12px; background: var(--raised); color: var(--ink); border-radius: 8px; }
.skip:focus { top: 8px; }

/* ---- Form fields ---- */
input, select, textarea { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--rule-strong); border-radius: 10px; padding: 9px 12px; min-height: 44px; width: 100%; max-width: 100%; }
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--link); border-radius: 10px; }
input[type="radio"], input[type="checkbox"] { width: auto; min-height: 0; accent-color: var(--red); }
input:disabled, select:disabled, textarea:disabled { opacity: 0.55; }
label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; }
fieldset { border: 0; margin: 0 0 1em; padding: 0; min-width: 0; }
legend { font-weight: 600; font-size: 0.95rem; margin-bottom: 6px; padding: 0; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px; border: 1px solid var(--rule-strong); border-radius: 999px; background: var(--raised); color: var(--ink); font: 600 1rem/1.2 var(--body); text-decoration: none; cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.15s; white-space: nowrap; }
.btn:hover { background: #241C27; border-color: #5C4C63; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 0 0 1px rgba(255, 77, 106, 0.3), 0 10px 30px -10px rgba(200, 16, 46, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.btn-primary:hover { background: var(--red-deep); border-color: var(--red-deep); color: #fff; }
.btn-quiet { background: transparent; }
.btn-small { min-height: 36px; padding: 6px 14px; font-size: 0.92rem; }
.btn-big { min-height: 52px; padding: 12px 26px; font-size: 1.05rem; }
.btn[aria-disabled="true"] { opacity: 0.5; cursor: default; pointer-events: none; }
.wv-danger { color: var(--bad); }
.wv-danger:hover { color: #FFB3B3; border-color: rgba(255, 138, 138, 0.6); }

/* ---- Messages ---- */
.flash { margin: 0 0 16px; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--rule-strong); background: var(--card); }
.flash-ok { border-color: rgba(74, 222, 128, 0.45); background: rgba(74, 222, 128, 0.07); }
.flash-error { border-color: rgba(255, 107, 107, 0.5); background: rgba(255, 107, 107, 0.08); }
.wv-fine { color: var(--muted); font-size: 0.9rem; }
.wv-warn { color: #FFD9D9; background: rgba(255, 107, 107, 0.1); border: 1px solid rgba(255, 107, 107, 0.45); border-radius: 10px; padding: 8px 12px; font-size: 0.92rem; }
.wv-viewing { margin: 0 0 16px; padding: 8px 14px; border-radius: 10px; border: 1px dashed var(--warn); color: #FDE7A9; font-size: 0.92rem; }

/* ---- The frame ---- */
.wv-top { position: sticky; top: 0; z-index: 30; background: rgba(9, 7, 10, 0.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
.wv-top-in { max-width: 1160px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.wv-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font: 800 1.3rem/1 var(--display); flex-shrink: 0; }
.wv-brand:hover { color: var(--ink); }
.wv-brand img { width: 34px; height: 34px; }
.wv-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; order: 3; flex-basis: 100%; margin: 0 -8px; }
.wv-tabs::-webkit-scrollbar { display: none; }
.wv-tabs a { flex-shrink: 0; padding: 8px 12px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.wv-tabs a:hover { color: var(--ink); background: var(--raised); }
.wv-tabs a[aria-current="page"] { color: var(--ink); background: var(--raised); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.wv-me { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.wv-me form { margin: 0; }
.wv-back { font-size: 0.95rem; white-space: nowrap; }
.wv-main { flex: 1; width: 100%; max-width: 1160px; margin: 0 auto; padding: 28px 16px 56px; }
.wv-foot { border-top: 1px solid var(--rule); padding: 20px 16px; color: var(--muted); font-size: 0.9rem; }
.wv-foot p { max-width: 1160px; margin: 0 auto; }
@media (min-width: 860px) {
  .wv-tabs { order: 0; flex-basis: auto; margin: 0; }
}

/* ---- Short pages ---- */
.wv-message { max-width: 520px; margin: 40px auto; text-align: center; }
.wv-message img { display: block; margin: 0 auto 12px; }
.wv-message p { color: var(--muted); }

/* ---- Landing ---- */
.wv-hero { display: grid; gap: 32px; align-items: center; margin: 8px 0 48px; }
.wv-hero h1 { font-size: clamp(2.1rem, 7vw, 3.6rem); margin-bottom: 16px; }
.wv-lede { color: var(--muted); font-size: 1.1rem; max-width: 560px; }
.wv-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.wv-note { max-width: 520px; color: var(--muted); font-size: 0.95rem; padding: 12px 16px; border: 1px dashed var(--rule-strong); border-radius: 12px; }
.wv-hero-flow { position: relative; margin: 0; aspect-ratio: 7 / 5; max-width: 480px; width: 100%; justify-self: center; border: 1px solid var(--rule); border-radius: var(--radius); background-color: var(--card); background-image: radial-gradient(var(--rule) 1px, transparent 1px); background-size: 20px 20px; overflow: hidden; }
.wv-hero-flow svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.wv-ribbon { fill: none; stroke: var(--red); stroke-width: 3; stroke-linecap: round; }
.wv-mini { position: absolute; display: flex; flex-direction: column; padding: 8px 14px; min-width: 136px; border-radius: 12px; background: var(--raised); border: 1px solid var(--rule-strong); border-left: 4px solid var(--red); box-shadow: 0 10px 30px -14px #000; }
.wv-mini b { font-size: 0.95rem; }
.wv-mini span { color: var(--muted); font-size: 0.82rem; }
.wv-how { border-top: 1px solid var(--rule); padding-top: 32px; }
.wv-pairs { display: grid; gap: 12px; margin: 0; }
.wv-pairs div { padding: 16px; border: 1px solid var(--rule); border-radius: 12px; background: var(--card); }
.wv-pairs dt { font-weight: 700; margin-bottom: 4px; }
.wv-pairs dd { margin: 0; color: var(--muted); font-size: 0.95rem; }
@media (min-width: 860px) {
  .wv-hero { grid-template-columns: 1.15fr 1fr; }
  .wv-pairs { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

/* ---- Page heads ---- */
.wv-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-bottom: 8px; }
.wv-head h1 { margin: 0; }
.wv-new { display: flex; gap: 8px; flex: 1 1 320px; max-width: 460px; }
.wv-new input { flex: 1; min-width: 0; }
.wv-sub, .wv-usage { color: var(--muted); max-width: 720px; }

/* ---- Flows list ---- */
.wv-empty { padding: 28px 24px; border: 1px dashed var(--rule-strong); border-radius: var(--radius); max-width: 640px; }
.wv-empty p { color: var(--muted); }
.wv-flows { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.wv-flow { display: grid; gap: 8px 16px; grid-template-columns: 1fr auto; align-items: center; padding: 16px 18px; border: 1px solid var(--rule); border-left: 4px solid var(--rule-strong); border-radius: 12px; background: var(--card); }
.wv-flow.is-on { border-left-color: var(--ok); }
.wv-flow.is-failing { border-left-color: var(--bad); }
.wv-flow-main { min-width: 0; grid-column: 1 / -1; }
.wv-flow h2 { font-size: 1.1rem; margin: 0 0 2px; overflow-wrap: anywhere; }
.wv-flow h2 a { color: var(--ink); text-decoration: none; }
.wv-flow h2 a:hover { color: var(--link-hi); text-decoration: underline; }
.wv-flow-when { margin: 0; color: var(--muted); font-size: 0.92rem; }
.wv-flow-facts { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 0.9rem; color: var(--muted); }
.wv-flow-switch { margin: 0; }
@media (min-width: 720px) {
  .wv-flow { grid-template-columns: minmax(0, 1fr) auto auto; }
  .wv-flow-main { grid-column: auto; }
}
.wv-state { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.82rem; font-weight: 600; border: 1px solid var(--rule-strong); color: var(--muted); }
.wv-state.is-on, .wv-state.is-done { color: #BBF7D0; border-color: rgba(74, 222, 128, 0.5); background: rgba(74, 222, 128, 0.08); }
.wv-state.is-bad, .wv-state.is-failed { color: #FFD1D1; border-color: rgba(255, 107, 107, 0.55); background: rgba(255, 107, 107, 0.1); }
.wv-state.is-waiting, .wv-state.is-queued, .wv-state.is-running { color: #FDE7A9; border-color: rgba(251, 191, 36, 0.5); background: rgba(251, 191, 36, 0.08); }
.wv-state.is-test { color: #E9D5FF; border-color: rgba(167, 139, 250, 0.5); }

/* ---- Templates ---- */
.wv-tpls { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.wv-tpl { display: flex; flex-direction: column; padding: 18px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); }
.wv-tpl h2 { font-size: 1.1rem; }
.wv-tpl > p { color: var(--muted); font-size: 0.95rem; }
.wv-tpl form { margin-top: auto; }
.wv-tpl-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.wv-tool { --t: var(--muted); display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; color: var(--ink); border: 1px solid var(--t); background: color-mix(in srgb, var(--t) 12%, transparent); }
.wv-tpl-need { font-size: 0.88rem !important; color: #FDE7A9 !important; }
.wv-tool-hexwork { --t: var(--t-hexwork); }
.wv-tool-familiar { --t: var(--t-familiar); }
.wv-tool-sigil { --t: var(--t-sigil); }
.wv-tool-keep { --t: var(--t-keep); }
.wv-tool-discord { --t: var(--t-discord); }
.wv-tool-weave { --t: var(--t-weave); }
.wv-tool-logic { --t: var(--t-logic); }
.wv-tool-bulwark { --t: var(--t-bulwark); }
.wv-tool-herald { --t: var(--t-herald); }
.wv-tool-banner { --t: var(--t-banner); }
.wv-tool-bard { --t: var(--t-bard); }
.wv-tool-slack { --t: var(--t-slack); }
.wv-tool-mailchimp { --t: var(--t-mailchimp); }
.wv-tool-stripe { --t: var(--t-stripe); }
.wv-tool-google { --t: var(--t-google); }
.wv-tool-xero { --t: var(--t-xero); }
.wv-tool-charm { --t: var(--t-charm); }
.wv-discord { margin-bottom: 24px; }
.wv-describe { margin: 0 0 24px; padding: 16px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); }
.wv-describe h2 { margin: 0 0 6px; font-size: 1.1rem; }
.wv-describe textarea { width: 100%; margin-top: 8px; }
.wv-port-else { border-style: dashed; }

/* ---- Tables (stack on a phone) ---- */
.wv-table { width: 100%; border-collapse: collapse; margin: 12px 0 24px; font-size: 0.95rem; }
.wv-table th, .wv-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.wv-table thead th { color: var(--muted); font-weight: 600; font-size: 0.88rem; }
.wv-table tbody th { font-weight: 600; }
.wv-table form { margin: 0; }
.wv-plan td, .wv-plan thead th { text-align: center; }
@media (max-width: 640px) {
  .wv-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .wv-table, .wv-table tbody, .wv-table tr, .wv-table th, .wv-table td { display: block; width: 100%; }
  .wv-table tr { padding: 10px 0; border-bottom: 1px solid var(--rule); }
  .wv-table th, .wv-table td { border: 0; padding: 3px 0; }
  .wv-table td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
  .wv-plan td, .wv-plan thead th { text-align: left; }
}

/* ---- Connections and filters ---- */
.wv-forms { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); margin-top: 16px; }
.wv-form { padding: 20px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); }
.wv-form h2 { font-size: 1.1rem; }
.wv-radios label { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 4px 0; }
.wv-filter { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; margin: 12px 0; }
.wv-filter label { margin: 0; align-self: center; }
.wv-filter select { width: auto; max-width: 100%; }
.wv-empty-line { color: var(--muted); }

/* ---- A run's log ---- */
.wv-log { list-style: none; margin: 16px 0; padding: 0; display: grid; gap: 6px; }
.wv-log li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 14px; border: 1px solid var(--rule); border-left: 4px solid var(--rule-strong); border-radius: 10px; background: var(--card); }
.wv-log li.is-ok { border-left-color: var(--ok); }
.wv-log li.is-bad { border-left-color: var(--bad); }
.wv-log b { font-weight: 600; }
.wv-log span { grid-column: 1 / -1; color: var(--muted); font-size: 0.93rem; overflow-wrap: anywhere; }
.wv-log time { grid-row: 1; grid-column: 2; color: var(--muted); font-size: 0.85rem; }
.wv-data { margin: 16px 0; padding: 12px 16px; border: 1px solid var(--rule); border-radius: 12px; background: var(--card); }
.wv-data summary { cursor: pointer; font-weight: 600; }
.wv-data dl { margin: 12px 0 0; display: grid; gap: 6px; }
.wv-data div { display: grid; grid-template-columns: minmax(90px, 180px) 1fr; gap: 12px; font-size: 0.92rem; }
.wv-data dt { color: var(--muted); overflow-wrap: anywhere; }
.wv-data dd { margin: 0; overflow-wrap: anywhere; }

/* ==== The canvas editor ==== */
.wv-is-editor .wv-main { max-width: none; padding: 0; display: flex; flex-direction: column; }
.wv-is-editor .wv-main > .flash, .wv-is-editor .wv-main > .wv-viewing { margin: 12px 16px 0; }
.wv-ed { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.wv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 16px; border-bottom: 1px solid var(--rule); background: var(--card); }
.wv-bar-back { font-weight: 600; white-space: nowrap; }
.wv-name { flex: 1 1 200px; max-width: 420px; min-height: 40px; font-weight: 700; background: transparent; border-color: transparent; }
.wv-name:hover { border-color: var(--rule-strong); }
.wv-save { color: var(--muted); font-size: 0.88rem; white-space: nowrap; }
.wv-bar-gap { flex: 1 1 0; }
.wv-more { position: relative; }
.wv-more summary { list-style: none; }
.wv-more summary::-webkit-details-marker { display: none; }
.wv-more-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; min-width: 190px; display: grid; gap: 4px; padding: 8px; border: 1px solid var(--rule-strong); border-radius: 12px; background: var(--raised); box-shadow: 0 16px 40px -12px #000; }
.wv-more-menu form { margin: 0; }
.wv-more-menu .btn { width: 100%; justify-content: flex-start; }

.wv-ed-body { flex: 1; display: grid; grid-template-columns: 1fr; min-height: 0; }
.wv-palette, .wv-inspect { padding: 16px; background: var(--card); overflow-y: auto; }
.wv-palette h2, .wv-inspect h2 { font-size: 1.05rem; }
.wv-palette h3 { margin: 16px 0 6px; font: 600 0.88rem/1.3 var(--body); color: var(--muted); }
.wv-pal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.wv-pal-item { --t: var(--muted); width: 100%; display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 1px; padding: 8px 12px; border: 1px solid var(--rule); border-left: 3px solid var(--t); border-radius: 10px; background: var(--raised); color: var(--ink); font: inherit; cursor: pointer; }
.wv-pal-item:hover { border-color: var(--rule-strong); border-left-color: var(--t); background: #221B25; }
.wv-pal-item:disabled { opacity: 0.55; cursor: default; }
.wv-pal-name { font-weight: 600; font-size: 0.93rem; }
.wv-pal-what { color: var(--muted); font-size: 0.82rem; line-height: 1.35; }

.wv-canvas { position: relative; overflow: hidden; min-height: 60vh; touch-action: none; cursor: grab; background-color: var(--paper); background-image: radial-gradient(#2A222C 1px, transparent 1px); background-size: 24px 24px; }
.wv-canvas:active { cursor: grabbing; }
.wv-world { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; }
/* A big drawing behind the boxes, in the canvas's own units (editor.js sets the matching viewBox). */
.wv-lines { position: absolute; left: -5000px; top: -5000px; width: 30000px; height: 30000px; max-width: none; overflow: visible; pointer-events: none; }
.wv-line-path { fill: none; stroke: #9A87A2; stroke-width: 2.5; pointer-events: none; }
.wv-line.is-no .wv-line-path { stroke-dasharray: 7 5; }
.wv-line.is-sel .wv-line-path { stroke: var(--link); stroke-width: 3.5; }
.wv-line-hit { fill: none; stroke: transparent; stroke-width: 18; cursor: pointer; pointer-events: stroke; }
.wv-line-hit:hover + .wv-line-path { stroke: var(--link-hi); }
.wv-line-temp { fill: none; stroke: var(--link); stroke-width: 2.5; stroke-dasharray: 6 5; pointer-events: none; }

.wv-node { --t: var(--muted); position: absolute; width: 232px; height: 76px; border-radius: 12px; background: var(--raised); border: 1px solid var(--rule-strong); border-left: 4px solid var(--t); box-shadow: 0 12px 28px -16px #000; cursor: move; touch-action: none; user-select: none; }
.wv-node.is-trigger { border-radius: 12px 12px 12px 12px; background: #1F1720; }
.wv-node.is-sel { border-color: var(--link); border-left-color: var(--t); box-shadow: 0 0 0 2px var(--link), 0 12px 28px -16px #000; }
.wv-node.is-target { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok); }
.wv-node.is-ok::after, .wv-node.is-bad::after { content: ""; position: absolute; top: 8px; right: 10px; width: 10px; height: 10px; border-radius: 50%; }
.wv-node.is-ok::after { background: var(--ok); }
.wv-node.is-bad { border-color: var(--bad); }
.wv-node.is-bad::after { background: var(--bad); }
.wv-node-face { display: flex; flex-direction: column; justify-content: center; width: 100%; height: 100%; padding: 8px 26px 8px 14px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: inherit; border-radius: 10px; }
.wv-node-face:focus-visible { box-shadow: inset 0 0 0 2px var(--link); }
.wv-node-kicker { font-size: 0.75rem; font-weight: 600; color: var(--t); line-height: 1.2; }
.wv-node-name { font-weight: 700; font-size: 0.95rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wv-node-sum { color: var(--muted); font-size: 0.8rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wv-port-in, .wv-port { position: absolute; z-index: 2; width: 18px; height: 18px; border-radius: 50%; background: var(--paper); border: 2px solid #A898AE; cursor: crosshair; touch-action: none; }
.wv-port-in { left: -10px; top: 50%; transform: translateY(-50%); }
.wv-port { right: -10px; transform: translateY(-50%); }
.wv-port::before, .wv-port-in::before { content: ""; position: absolute; inset: -12px; border-radius: 50%; }
.wv-port:hover, .wv-port-in:hover { border-color: var(--link); background: var(--link); }
.is-joining .wv-canvas, .is-joining .wv-node { cursor: crosshair; }
.wv-port i { position: absolute; left: 20px; pointer-events: none; top: 50%; transform: translateY(-50%); font: 600 0.72rem/1 var(--body); font-style: normal; color: var(--muted); }
.wv-port-yes { border-color: var(--ok); }
.wv-port-no { border-color: var(--bad); }
.wv-zoom { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 2px; padding: 4px; border: 1px solid var(--rule-strong); border-radius: 999px; background: rgba(17, 14, 19, 0.92); }
.wv-zoom .btn { min-width: 36px; padding: 6px 10px; }
.wv-noscript { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); }

.wv-inspect .wv-field { margin: 0 0 14px; }
.wv-inspect .wv-field .wv-fine { display: block; margin-top: 4px; }
.wv-inspect input, .wv-inspect select, .wv-inspect textarea { font-size: 0.95rem; }
.wv-status { margin: 18px 0 0; padding: 12px 14px; border: 1px solid var(--rule-strong); border-radius: 12px; background: var(--raised); font-size: 0.92rem; }
.wv-status h3 { margin-bottom: 6px; }
.wv-status ul { margin: 0; padding-left: 18px; color: var(--muted); }
.wv-status p:last-child { margin-bottom: 0; }
.wv-status .wv-warn { margin-bottom: 10px; }

.wv-result { position: fixed; z-index: 35; left: 12px; right: 12px; bottom: 12px; max-height: 55vh; overflow-y: auto; padding: 14px 16px; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--raised); box-shadow: 0 24px 60px -20px #000; }
.wv-result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wv-result-head h2 { margin: 0; font-size: 1.05rem; }
.wv-result .wv-log { margin-bottom: 0; }
.wv-result .wv-log li { background: var(--card); }

@media (min-width: 1000px) {
  .wv-is-editor { height: 100vh; overflow: hidden; }
  .wv-is-editor .wv-top { position: static; }
  .wv-ed-body { grid-template-columns: 250px minmax(0, 1fr) 320px; }
  .wv-palette { border-right: 1px solid var(--rule); }
  .wv-inspect { border-left: 1px solid var(--rule); }
  .wv-canvas { min-height: 0; }
  .wv-result { left: auto; right: 336px; width: min(460px, calc(100vw - 620px)); }
}
@media (max-width: 999px) {
  .wv-canvas { order: -1; height: 62vh; border-bottom: 1px solid var(--rule); }
  .wv-inspect { border-bottom: 1px solid var(--rule); order: 0; }
  .wv-palette { order: 1; }
}

/* ---- Motion ---- */
.wv-anim .wv-node { transition: box-shadow 0.15s, border-color 0.15s; }
.wv-anim .wv-line-path { transition: stroke 0.15s; }
.wv-anim .wv-node.is-ok, .wv-anim .wv-node.is-bad { animation: wv-pop 0.35s ease-out; }
@keyframes wv-pop { from { transform: scale(0.97); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
