/* ─── Reset ─────────────────────────────────────────────────────────────────── */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

img {
    -webkit-user-drag: none;
    user-drag: none;
}

/* ─── Custom Properties ──────────────────────────────────────────────────────── */

:root {
    --bg:                  #101218;
    --grid-size:           20px;
    --grid-color:          rgba(255, 255, 255, 0.04);
    --grid-color-strong:   rgba(255, 255, 255, 0.1);
    --workspace-zoom:      1;

    --hud-bg:              rgba(20, 20, 28, 0.75);
    --hud-border:          rgba(255, 255, 255, 0.08);
    --hud-text:            rgba(255, 255, 255, 0.7);
    --hud-hover:           rgba(255, 255, 255, 0.12);
}

/* ─── Base ────────────────────────────────────────────────────────────────────── */

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    font-family: system-ui, sans-serif;
    color: #fff;
}

/* ─── Workspace canvas ────────────────────────────────────────────────────────── */

.workspace-canvas {
    --workspace-zoom: 1;
    position: fixed;
    inset: 0;
    overflow: hidden;
    cursor: grab;
    touch-action: none;

    background-image:
        linear-gradient(var(--grid-color-strong) 2px, transparent 2px),
        linear-gradient(90deg, var(--grid-color-strong) 2px, transparent 2px),
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);

    background-size:
        calc(var(--grid-size) * var(--workspace-zoom) * 5) calc(var(--grid-size) * var(--workspace-zoom) * 5),
        calc(var(--grid-size) * var(--workspace-zoom) * 5) calc(var(--grid-size) * var(--workspace-zoom) * 5),
        calc(var(--grid-size) * var(--workspace-zoom)) calc(var(--grid-size) * var(--workspace-zoom)),
        calc(var(--grid-size) * var(--workspace-zoom)) calc(var(--grid-size) * var(--workspace-zoom));

    background-repeat: repeat;
    background-position: 0 0, 0 0, 0 0, 0 0;
    background-color: var(--bg);
}

.workspace-canvas:active {
    cursor: grabbing;
}

/* ─── World layer ─────────────────────────────────────────────────────────────── */

.world-layer {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    pointer-events: none;
}

.world-image {
    position: absolute;
    display: block;
    image-rendering: pixelated;
}

/* ─── Debug panel ─────────────────────────────────────────────────────────────── */

.debug-panel {
    display: none !important;
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 200;
    min-width: 240px;
    background: rgba(10, 11, 16, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px 12px;
    backdrop-filter: blur(10px);
    font-family: "Cascadia Code", "Fira Code", ui-monospace, monospace;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.55);
    flex-direction: column;
    gap: 3px;
    user-select: none;
}

.debug-title {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.3);
    margin-bottom: 4px;
}

.debug-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-height: 16px;
}

.debug-check-row {
    align-items: center;
    cursor: pointer;
}

.debug-label {
    flex: 0 0 54px;
    color: rgba(255, 255, 255, 0.35);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.debug-value {
    color: rgba(180, 220, 255, 0.85);
    white-space: nowrap;
}

.debug-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.07);
    margin: 4px 0;
}

.debug-draggable-cb {
    margin: 0;
    accent-color: rgba(100, 160, 255, 0.9);
    cursor: pointer;
}

.debug-copy-btn {
    margin-left: auto;
    padding: 1px 6px;
    font-family: inherit;
    font-size: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(180, 220, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.debug-copy-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.debug-subtitle {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.25);
    margin-top: 4px;
    margin-bottom: 2px;
}

.debug-input {
    flex: 1;
    font-family: inherit;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(180, 220, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    padding: 2px 5px;
    outline: none;
    min-width: 0;
}

.debug-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(100, 160, 255, 0.5);
}

.debug-input:read-only {
    color: rgba(255, 255, 255, 0.4);
    cursor: not-allowed;
}

.debug-node-editor {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.debug-pins-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 4px;
}

.debug-pin-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.debug-pin-row {
    display: flex;
    gap: 3px;
    align-items: center;
}

.debug-pin-input {
    flex: 1;
    font-family: inherit;
    font-size: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(180, 220, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    padding: 2px 4px;
    outline: none;
    min-width: 0;
}

.debug-pin-input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(100, 160, 255, 0.5);
}

.debug-pin-id {
    max-width: 80px;
}

.debug-pin-kind {
    max-width: 70px;
}

.debug-pin-remove {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    padding: 0;
    font-size: 14px;
    line-height: 1;
    background: rgba(255, 80, 80, 0.2);
    color: rgba(255, 120, 120, 0.9);
    border: 1px solid rgba(255, 80, 80, 0.3);
    border-radius: 3px;
    cursor: pointer;
}

.debug-pin-remove:hover {
    background: rgba(255, 80, 80, 0.3);
}

.debug-add-btn {
    font-family: inherit;
    font-size: 10px;
    padding: 3px 6px;
    background: rgba(100, 160, 255, 0.15);
    color: rgba(180, 220, 255, 0.9);
    border: 1px solid rgba(100, 160, 255, 0.3);
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 6px;
}

.debug-add-btn:hover {
    background: rgba(100, 160, 255, 0.25);
}

/* ─── HUD ─────────────────────────────────────────────────────────────────────── */

.hud {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 100;
}

.hud-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--hud-border);
    background: var(--hud-bg);
    color: var(--hud-text);
    font-size: 18px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hud-btn:hover {
    background: var(--hud-hover);
}

.hud-btn-drag {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--hud-border);
    background: var(--hud-bg);
    color: var(--hud-text);
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.hud-btn-drag:hover {
    background: var(--hud-hover);
}

.hud-btn-drag.active {
    background: rgba(60, 120, 255, 0.9);
    border-color: rgba(80, 140, 255, 0.5);
}

.hud-btn-drag.active:hover {
    background: rgba(80, 140, 255, 1);
}

/* ─── Node + Connection layers ───────────────────────────────────────────────── */

.connection-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.node-layer {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.node-drag-ghost {
    position: absolute;
    pointer-events: none;
    border-radius: 8px;
    border: 2px solid rgba(255, 127, 17, 0.6);
    background: rgba(255, 127, 17, 0.07);
    opacity: 0.5;
    z-index: 5;
    transition: transform 140ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ─── Comment boxes ───────────────────────────────────────────────────────────── */

.comment-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.blueprint-comment {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    pointer-events: auto;
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 0;
    overflow: hidden;
}

.comment-background {
    position: absolute;
    inset: 0;
    z-index: -1;
}

.comment-title {
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #ffffff;
    text-shadow: 
        0 0 12px rgba(255, 255, 255, 0.4),
        0 1px 2px rgba(0, 0, 0, 0.8);
    background: linear-gradient(180deg, 
        rgba(0, 0, 0, 0.3) 0%, 
        rgba(0, 0, 0, 0.2) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 1;
}

/* ─── Blueprint node ──────────────────────────────────────────────────────────── */

.blueprint-node {
    position: absolute;
    min-width: 220px;
    background: #1d2029;
    border: 1px solid #2f3544;
    border-radius: 8px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto;
    grid-template-areas:
        'header header'
        'inputs outputs'
        'body   body';
    column-gap: 0.35rem;
    overflow: visible;
    pointer-events: auto;
    transition: box-shadow 160ms ease, border-color 160ms ease;
}

.blueprint-node:hover {
    border-color: rgba(255, 127, 17, 0.15);
}

/* ─── Pure node ──────────────────────────────────────────────────────────────── */

.blueprint-node[data-node-type="pure"] {
    border-radius: 12px;
    border-color: rgba(62, 229, 129, 0.3);
    background: #1a2120;
    min-width: 0;
}

.blueprint-node[data-node-type="pure"]:hover {
    border-color: rgba(62, 229, 129, 0.55);
}

.blueprint-node[data-node-type="pure"] .node-header {
    background: linear-gradient(90deg, rgba(62, 229, 129, 0.14), rgba(62, 229, 129, 0.06));
    border-bottom-color: rgba(62, 229, 129, 0.15);
    color: #7effc0;
    font-size: 0.78rem;
    padding: 0.35rem 0.7rem;
}

.node-body--image {
    padding: 0;
    border-top: 1px solid rgba(62, 229, 129, 0.12);
    overflow: hidden;
    line-height: 0;
}

.node-image {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    image-rendering: pixelated;
    pointer-events: none;
}

/* ─── Button node ────────────────────────────────────────────────────────────── */

.blueprint-node[data-node-type="button"] {
    border-color: rgba(255, 160, 60, 0.35);
    background: #201e18;
}

.blueprint-node[data-node-type="button"]:hover {
    border-color: rgba(255, 160, 60, 0.6);
}

.blueprint-node[data-node-type="button"] .node-header {
    background: linear-gradient(90deg, rgba(255, 160, 60, 0.18), rgba(255, 160, 60, 0.06));
    border-bottom-color: rgba(255, 160, 60, 0.18);
    color: #ffd080;
}

.node-run-btn {
    margin-left: auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 160, 60, 0.75);
    color: #1a1600;
    line-height: 0;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 120ms ease, transform 80ms ease;
    pointer-events: auto;
}

.node-run-btn:hover {
    background: rgba(255, 180, 80, 1);
    transform: scale(1.12);
}

.node-run-btn:active {
    transform: scale(0.92);
}

@keyframes node-run-flash {
    0%   { box-shadow: 0 0 0 0   rgba(255, 180, 80, 0.8); }
    60%  { box-shadow: 0 0 0 8px rgba(255, 180, 80, 0);   }
    100% { box-shadow: 0 0 0 0   rgba(255, 180, 80, 0);   }
}

.node-run-btn--flash {
    animation: node-run-flash 320ms ease-out forwards;
}

/* ─── Print node ─────────────────────────────────────────────────────────────── */

.blueprint-node[data-node-type="print"] {
    border-color: rgba(94, 196, 255, 0.25);
    background: #181d22;
}

.blueprint-node[data-node-type="print"]:hover {
    border-color: rgba(94, 196, 255, 0.5);
}

.blueprint-node[data-node-type="print"] .node-header {
    background: linear-gradient(90deg, rgba(94, 196, 255, 0.14), rgba(94, 196, 255, 0.05));
    border-bottom-color: rgba(94, 196, 255, 0.15);
    color: #a8e8ff;
}

/* ─── Timer node ─────────────────────────────────────────────────────────────── */

.blueprint-node[data-node-type="timer"] {
    border-color: rgba(180, 120, 255, 0.3);
    background: #1c1a28;
}

.blueprint-node[data-node-type="timer"]:hover {
    border-color: rgba(180, 120, 255, 0.55);
}

.blueprint-node[data-node-type="timer"] .node-header {
    background: linear-gradient(90deg, rgba(180, 120, 255, 0.16), rgba(180, 120, 255, 0.06));
    border-bottom-color: rgba(180, 120, 255, 0.18);
    color: #d4aaff;
    border-top-left-radius: 7px;
    border-top-right-radius: 7px;
    overflow: hidden;
}

.node-timer-btn {
    margin-left: auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(180, 120, 255, 0.7);
    color: #100a1a;
    line-height: 0;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 120ms ease, transform 80ms ease;
    pointer-events: auto;
}

.node-timer-btn:hover {
    background: rgba(200, 150, 255, 1);
    transform: scale(1.12);
}

.node-timer-btn:active {
    transform: scale(0.92);
}

.node-timer-btn[data-running="true"] {
    background: rgba(255, 90, 90, 0.8);
    color: #fff;
    animation: timer-pulse 1s ease-in-out infinite;
}

@keyframes timer-pulse {
    0%, 100% { box-shadow: 0 0 0 0   rgba(255, 90, 90, 0.6); }
    50%       { box-shadow: 0 0 0 6px rgba(255, 90, 90, 0);   }
}

/* ─── Number pin input chip ──────────────────────────────────────────────────── */

.pin-value--number {
    font-family: "Cascadia Code", "Fira Code", ui-monospace, monospace;
    font-size: 0.7rem;
    color: #c8a0ff;
    background: rgba(180, 120, 255, 0.08);
    border: 1px solid rgba(180, 120, 255, 0.25);
    border-radius: 4px;
    padding: 1px 5px;
    width: 5ch;
    text-align: center;
    order: 1;
    outline: none;
    pointer-events: auto;
    cursor: text;
    -moz-appearance: textfield;
    appearance: textfield;
    transition: border-color 120ms ease, background 120ms ease;
}

.pin-value--number::-webkit-outer-spin-button,
.pin-value--number::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

.pin-value--number:focus {
    border-color: rgba(180, 120, 255, 0.7);
    background: rgba(180, 120, 255, 0.15);
}

/* ─── Print speech bubble stack ─────────────────────────────────────────────── */

.print-bubble-stack {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
    pointer-events: none;
    z-index: 20;
    /* downward arrow tail */
}

.print-bubble-stack:not(:empty)::after {
    content: '';
    position: absolute;
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(94, 196, 255, 0.45);
    border-bottom: none;
}

.print-bubble-msg {
    background: rgba(16, 26, 38, 0.96);
    border: 1px solid rgba(94, 196, 255, 0.4);
    border-radius: 7px;
    color: #a8e8ff;
    font-family: "Cascadia Code", "Fira Code", ui-monospace, monospace;
    font-size: 0.72rem;
    padding: 4px 10px;
    white-space: nowrap;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5), 0 0 6px rgba(94, 196, 255, 0.08);
    animation: bubble-enter 0.18s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.print-bubble-msg.is-fading {
    animation: bubble-exit 0.5s ease-in forwards;
}

@keyframes bubble-enter {
    from { opacity: 0; transform: translateY(5px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

@keyframes bubble-exit {
    from { opacity: 1; transform: translateY(0);   }
    to   { opacity: 0; transform: translateY(-4px); }
}

.node-header {
    grid-area: header;
    background: linear-gradient(90deg, #1d2029, #242833);
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    border-bottom: 1px solid #2f3544;
    color: #f6f9ff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-top-left-radius: 7px;
    border-top-right-radius: 7px;
    overflow: hidden;
}

.node-io {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.35rem 0.25rem;
}

.node-inputs {
    grid-area: inputs;
    align-items: flex-start;
}

.node-outputs {
    grid-area: outputs;
    align-items: flex-end;
}

/* ─── Pins ────────────────────────────────────────────────────────────────────── */

.pin {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    padding: 2px 4px;
    border-radius: 4px;
    position: relative;
    cursor: default;
}

.pin-label {
    color: #a8b2cc;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.68rem;
    order: 1;
}

.pin-label.is-hidden {
    display: none;
}

/* Input: handle left, label right */
.node-inputs .pin .pin-label  { order: 2; }
.node-inputs .pin .pin-handle { order: 0; }

/* Output: label left, handle right */
.node-outputs .pin .pin-label  { order: 0; text-align: right; }
.node-outputs .pin .pin-handle { order: 2; }

.pin-handle {
    display: inline-flex;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #2f3544;
    background: #242833;
    position: relative;
    flex-shrink: 0;
    order: 2;
    margin: 3px 0;
    color: var(--pin-kind-color, #8c919d);
}

.pin-handle::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: currentColor;
    transition: transform 120ms ease;
}

/* Disconnected data pins */
.pin.is-disconnected .pin-handle {
    background: transparent;
    border-color: currentColor;
    width: 16px;
    height: 16px;
}

.pin.is-disconnected .pin-handle::after {
    inset: 4px;
    background: transparent;
    box-shadow: inset 0 0 0 2.5px currentColor;
}

.pin.is-disconnected:not([data-type='exec']) .pin-handle::after {
    background: transparent;
    box-shadow: none;
    opacity: 0;
}

/* Exec pin shape */
.pin[data-type='exec'] .pin-handle {
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 0;
    background: transparent;
    margin: 2px 0;
}

.pin[data-type='exec'] .pin-handle::after {
    inset: 0;
    border-radius: 0;
    clip-path: polygon(0% 0%, 60% 0%, 100% 50%, 60% 100%, 0% 100%);
    background: currentColor;
}

/* Disconnected exec pin */
.pin[data-type='exec'].is-disconnected .pin-handle::after {
    inset: 0;
    background: currentColor;
    box-shadow: none;
    opacity: 1;
}

/* Pulsating exec pin (Begin Play hint) */
.pin--pulsate[data-type='exec'] .pin-handle::after {
    animation: exec-pin-pulse 2s ease-in-out infinite;
}

@keyframes exec-pin-pulse {
    0%, 100% { 
        filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.4));
        transform: scale(1);
    }
    50% { 
        filter: drop-shadow(0 0 16px rgba(255, 255, 255, 1)) 
                drop-shadow(0 0 24px rgba(255, 255, 255, 0.6));
        transform: scale(1.2);
    }
}

/* Hand pointer hint */
.pin-hint-hand {
    position: absolute;
    left: 0px;
    top: 30px;
    width: 24px;
    height: 24px;
    pointer-events: none;
    opacity: 0.9;
    animation: hand-bounce 2s ease-in-out infinite;
}

@keyframes hand-bounce {
    0%, 100% { 
        transform: translateY(-4px);
    }
    50% { 
        transform: translateY(0);
    }
}

.pin[data-type='exec'].is-disconnected .pin-handle::before {
    content: '';
    position: absolute;
    inset: 2.5px;
    clip-path: polygon(0% 0%, 60% 0%, 100% 50%, 60% 100%, 0% 100%);
    background: #1d2029;
    pointer-events: none;
    z-index: 1;
}

/* Connected exec pin — solid fill */
.pin[data-type='exec'].is-connected .pin-handle::before {
    display: none;
}

.pin.is-clickable {
    cursor: pointer;
}

.pin.is-clickable.is-disconnected {
    cursor: default;
}

.pin.is-clickable .pin-handle {
    transition: transform 120ms ease, filter 120ms ease;
}

/* ─── String pin default value chip ─────────────────────────────────────────── */

.pin-value {
    font-family: "Cascadia Code", "Fira Code", ui-monospace, monospace;
    font-size: 0.7rem;
    color: #ff66ff;
    background: rgba(255, 102, 255, 0.08);
    border: 1px solid rgba(255, 102, 255, 0.25);
    border-radius: 4px;
    padding: 1px 5px;
    order: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
    pointer-events: auto;
    cursor: text;
    outline: none;
    min-width: 1ch;
    transition: border-color 120ms ease, background 120ms ease;
}

.pin-value:focus {
    border-color: rgba(255, 102, 255, 0.7);
    background: rgba(255, 102, 255, 0.15);
    text-overflow: clip;
}

/* In output rows the value chip sits between label and handle */
.node-outputs .pin .pin-value { order: 1; }

/* In input rows the value chip sits between handle and label */
.node-inputs .pin .pin-value { order: 1; }

.pin.is-clickable:hover:not(.is-disconnected) .pin-handle {
    transform: scale(1.25);
    filter: brightness(1.4);
}

/* ─── Connection wire hover highlight ───────────────────────────────────────── */

#connectionLayer path {
    transition: stroke-width 120ms ease, filter 120ms ease;
}

#connectionLayer path[data-highlighted="true"] {
    stroke-width: 4.5;
    filter: brightness(1.5) drop-shadow(0 0 5px currentColor);
}

/* ─── Node body (info / markdown) ───────────────────────────────────────────── */

.node-body {
    grid-area: body;
    padding: 0.75rem 0.9rem;
    border-top: 1px solid #2f3544;
    max-width: 360px;
    min-width: 280px;
    color: #c8d0e8;
    font-size: 0.8rem;
    line-height: 1.6;
    user-select: text;
    cursor: text;
}

.node-body .md-h1,
.node-body .md-h2,
.node-body .md-h3 {
    color: #f0f4ff;
    font-weight: 700;
    margin-bottom: 0.3em;
    margin-top: 0.6em;
    letter-spacing: 0.01em;
}

.node-body .md-h1 { font-size: 1.4rem; }
.node-body .md-h2 { font-size: 0.88rem; }
.node-body .md-h3 { font-size: 0.82rem; }

.node-body .md-p {
    margin: 0.4em 0;
}

.node-body .md-ul,
.node-body .md-ol {
    margin: 0.3em 0 0.3em 1.1em;
    padding: 0;
}

.node-body .md-li {
    margin: 0.15em 0;
}

.node-body .md-blockquote {
    border-left: 3px solid rgba(255, 160, 60, 0.5);
    padding: 0.2em 0.7em;
    margin: 0.4em 0;
    color: rgba(200, 210, 230, 0.7);
    font-style: italic;
}

.node-body .md-code {
    font-family: "Cascadia Code", "Fira Code", ui-monospace, monospace;
    font-size: 0.78em;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 3px;
    padding: 0.1em 0.35em;
    color: #a8daff;
}

.node-body .md-pre {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid #2f3544;
    border-radius: 5px;
    padding: 0.5em 0.7em;
    overflow-x: auto;
    margin: 0.4em 0;
    font-family: "Cascadia Code", "Fira Code", ui-monospace, monospace;
    font-size: 0.76em;
    color: #a8daff;
}

.node-body .md-hr {
    border: none;
    border-top: 1px solid #2f3544;
    margin: 0.6em 0;
}

.node-body .md-link {
    color: rgba(120, 200, 255, 0.9);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
}

.node-body .md-link:hover {
    color: #fff;
}

.node-body .md-link-icon {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
    vertical-align: middle;
}

.node-body .md-error {
    color: rgba(255, 100, 100, 0.7);
    font-size: 0.75em;
}

