:root {
    --node-w: 200px;
}

:root:not([data-theme="hike"]) {
    --bg: #07070d;
    --node-bg: #111118;
    --node-border: rgba(255, 255, 255, 0.08);
    --node-glow: rgba(100, 80, 255, 0.5);
    --accent: #8b5cf6;
    --accent2: #6d28d9;
    --handle: #6b7280;
    --conn: rgba(150, 130, 255, 0.7);
    --text: #e8e8f2;
    --text-dim: #6b7280;
    --radius: 14px;
}

[data-theme="hike"] {
    --bg: #FCF9F7;
    --node-bg: #FFFFFF;
    --node-border: rgba(26, 20, 32, 0.07);
    --node-glow: rgba(126, 110, 148, 0.2);
    --accent: #7C3AED;
    --accent2: #6D28D9;
    --handle: #A198A6;
    --conn: rgba(126, 110, 148, 0.45);
    --text: #1A1420;
    --text-dim: #6B6272;
    --radius: 14px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* dot grid bg */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
    z-index: 0;
}

/* ── Auth Gate ── */
#authGate {
    position: relative;
    z-index: 10;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 0;
    padding: 1.5rem;
}

/* Glassmorphism card that wraps all auth content */
#authGate > * { width: 100%; max-width: 360px; }

#authGate .auth-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 20px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: 2rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    box-shadow: 0 8px 40px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.06);
    width: 100%;
    max-width: 360px;
}

#authGate h2 {
    font-size: .92rem;
    font-weight: 500;
    color: var(--text-dim);
    text-align: center;
    margin: 0;
    letter-spacing: .01em;
}

#authErr {
    color: #f87171;
    font-size: .78rem;
    text-align: center;
    min-height: 1.1em;
    margin-top: -.4rem;
}

/* ── Layout ── */
#app {
    display: none;
    flex-direction: column;
    height: 100vh;
    position: relative;
    z-index: 1;
}

/* Header & tabs are defined in shared.css for consistency across all pages */

.user-chip {
    font-size: .72rem;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.05);
    padding: .25rem .65rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ── Token bar (canvas header) ── */
.token-bar {
    width: 64px;
    height: 5px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    overflow: hidden;
    flex-shrink: 0;
}

.token-fill {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #6d28d9);
    border-radius: 99px;
    transition: width .4s ease;
}

.token-fill.empty {
    background: #ef4444;
}

.token-count {
    font-size: .68rem;
    color: var(--text-dim);
    white-space: nowrap;
}

.token-count.empty {
    color: #f87171;
}

/* ── No-credits toast ── */
.no-credits-toast {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #f87171;
    font-size: .7rem;
    font-weight: 500;
    padding: .3rem .7rem;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    animation: fadeUpIn .2s ease;
    z-index: 500;
}

@keyframes fadeUpIn {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}


/* ── Toolbar ── */
#toolbar {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    background: rgba(7, 7, 13, 0.6);
}

#toolbar .btn:hover {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.06), 0 0 8px rgba(255, 255, 255, 0.04);
}

#toolbar .btn:hover .tb-plus {
    opacity: 1;
}

.tb-sep {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.07);
    margin: 0 .2rem;
}

.tb-plus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    font-size: .65rem;
    font-weight: 600;
    line-height: 1;
    margin-left: .25rem;
    opacity: .7;
    vertical-align: middle;
}


.hint {
    font-size: .72rem;
    color: var(--text-dim);
    margin-left: auto;
}

/* ── Workspace ── */
#workspace {
    flex: 1;
    overflow: hidden;
    position: relative;
    cursor: grab;
}

#world {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    width: 5000px;
    height: 5000px;
}

#svgLayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

/* ── Empty state ── */
#empty {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    opacity: .35;
}

#empty h3 {
    font-size: 1.1rem;
    margin-bottom: .5rem;
    font-weight: 500;
}

#empty p {
    font-size: .8rem;
    color: var(--text-dim);
}

/* ── Nodes ── */
.c-node {
    position: absolute;
    width: var(--node-w);
    background: var(--node-bg);
    border: 1.5px solid var(--node-border);
    border-radius: var(--radius);
    cursor: grab;
    user-select: none;
    transition: border-color .2s, box-shadow .2s;
}

.c-node:hover {
    border-color: rgba(139, 92, 246, 0.35);
}

.c-node.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.3), 0 0 24px rgba(139, 92, 246, 0.2);
}

.c-node.dragging {
    cursor: grabbing;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    z-index: 200;
}

.node-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .45rem .65rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.node-type {
    font-size: .65rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: .35rem;
    font-weight: 500;
}

.node-del {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: .8rem;
    padding: .1rem .3rem;
    border-radius: 4px;
    line-height: 1;
    opacity: 0;
    transition: .15s;
}

.c-node:hover .node-del {
    opacity: 1;
}

.node-del:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

.node-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

/* result nodes show natural ratio, no crop */
.node-result .node-img,
.node-result-slot .node-img {
    aspect-ratio: unset;
    object-fit: contain;
    border-radius: 0;
}

.result-actions {
    display: flex;
    gap: .3rem;
    padding: .35rem .5rem;
    border-top: 1px solid rgba(52, 211, 153, 0.1);
}

.res-action-btn {
    flex: 1;
    background: rgba(52, 211, 153, 0.07);
    border: 1px solid rgba(52, 211, 153, 0.15);
    color: #34d399;
    border-radius: 6px;
    padding: .28rem .3rem;
    font-size: .65rem;
    font-weight: 500;
    cursor: pointer;
    transition: .15s;
}

.res-action-btn:hover {
    background: rgba(52, 211, 153, 0.15);
}

/* Preview modal */
#previewModal {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

#previewModal.open {
    display: flex;
}

#previewModal img {
    max-width: min(90vw, 900px);
    max-height: 88vh;
    border-radius: 10px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
    object-fit: contain;
    cursor: default;
}

#previewModal .pm-close {
    position: absolute;
    top: 1.2rem;
    right: 1.4rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text);
    border-radius: 8px;
    padding: .3rem .65rem;
    font-size: .8rem;
    cursor: pointer;
}

.node-lbl {
    font-size: .65rem;
    color: var(--text-dim);
    padding: .3rem .65rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.img-actions {
    display: flex;
    padding: .3rem .5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.img-change-btn {
    flex: 1;
    background: rgba(139, 92, 246, 0.07);
    border: 1px solid rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border-radius: 6px;
    padding: .28rem .3rem;
    font-size: .65rem;
    font-weight: 500;
    cursor: pointer;
    transition: .15s;
}

.img-change-btn:hover {
    background: rgba(139, 92, 246, 0.15);
}

/* ── Image node: empty placeholder state ── */
.node-img-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: 1.4rem .75rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background .15s;
}

.node-img-empty:hover {
    background: rgba(139, 92, 246, 0.07);
}

.img-empty-icon {
    font-size: 1.6rem;
    opacity: .45;
    pointer-events: none;
}

.img-empty-hint {
    font-size: .62rem;
    color: var(--text-dim);
    text-align: center;
    pointer-events: none;
}

/* Add image button (same look as img-change-btn) */
.img-add-btn {
    flex: 1;
    background: rgba(139, 92, 246, 0.07);
    border: 1px solid rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border-radius: 6px;
    padding: .28rem .3rem;
    font-size: .65rem;
    font-weight: 500;
    cursor: pointer;
    transition: .15s;
}

.img-add-btn:hover {
    background: rgba(139, 92, 246, 0.15);
}

/* prompt node */
.node-prompt-body {
    padding: .65rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.node-prompt-body textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: .5rem;
    color: var(--text);
    font-family: inherit;
    font-size: .75rem;
    resize: none;
    height: 80px;
    outline: none;
}

.node-prompt-body textarea:focus {
    border-color: rgba(139, 92, 246, 0.4);
}

/* output type toggle on prompt cards */
.p-out-row {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .28rem 0 .05rem;
}

.p-out-label {
    font-size: .62rem;
    color: var(--text-dim);
}

.p-out-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.p-out-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: .62rem;
    font-weight: 500;
    font-family: inherit;
    padding: .22rem .45rem;
    cursor: pointer;
    transition: .15s;
}

.p-out-btn.active {
    background: rgba(139, 92, 246, 0.18);
    color: #c4b5fd;
}

/* text result nodes */
.node-text-body {
    padding: .6rem .65rem;
    font-size: .7rem;
    line-height: 1.55;
    color: var(--text);
    max-height: 180px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.node-text-body::-webkit-scrollbar {
    width: 3px;
}

.node-text-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

/* ── Connection handles ── */
.c-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--handle);
    border: 2px solid var(--bg);
    border-radius: 50%;
    cursor: crosshair;
    opacity: 0;
    transition: opacity .15s, transform .15s;
    z-index: 10;
}

.c-node:hover .c-handle,
.c-handle:hover {
    opacity: 1;
}

.c-handle:hover {
    transform: scale(1.4);
}

.c-handle-l {
    left: -7px;
    top: 50%;
    margin-top: -6px;
}

.c-handle-r {
    right: -7px;
    top: 50%;
    margin-top: -6px;
}

/* ── Quick-add "+" button — sits just outside the right handle ── */
.node-add-btn {
    position: absolute;
    right: -28px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid rgba(139, 92, 246, 0.5);
    background: rgba(10, 8, 20, 0.9);
    color: #a78bfa;
    font-size: .75rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .15s, transform .15s, box-shadow .15s;
    z-index: 15;
    padding: 0;
}

.c-node:hover .node-add-btn {
    opacity: 1;
}

.node-add-btn:hover {
    transform: translateY(-50%) scale(1.25);
    background: rgba(139, 92, 246, 0.2);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
    border-color: rgba(139, 92, 246, 0.9);
}


/* in connect-mode always show handles */
body.connect-mode .c-handle {
    opacity: .6;
}

body.connect-mode .c-handle:hover {
    opacity: 1;
    transform: scale(1.4);
}

/* ── SVG connections ── */
.c-path {
    fill: none;
    stroke: var(--conn);
    stroke-width: 1.5;
    stroke-dasharray: 6 4;
    stroke-linecap: round;
    cursor: pointer;
    pointer-events: stroke;
}

.c-path:hover {
    stroke: rgba(200, 180, 255, 0.95);
    stroke-width: 2.5;
}

.c-temp {
    fill: none;
    stroke: rgba(139, 92, 246, 0.45);
    stroke-width: 1.5;
    stroke-dasharray: 6 4;
    pointer-events: none;
}

/* Selected (click to target for deletion) */
.c-path-selected {
    stroke: rgba(248, 113, 113, 0.9) !important;
    stroke-width: 2.5 !important;
    stroke-dasharray: none !important;
    filter: drop-shadow(0 0 4px rgba(248, 113, 113, 0.5));
}

/* ── Marquee multi-select rectangle ── */
.marquee-rect {
    position: absolute;
    border: 1.5px dashed rgba(139, 92, 246, 0.8);
    background: rgba(139, 92, 246, 0.06);
    border-radius: 4px;
    pointer-events: none;
    z-index: 100;
    box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.15);
}


/* ── Buttons ── */
.btn {
    border: none;
    border-radius: 8px;
    padding: .4rem .85rem;
    font-family: inherit;
    font-size: .8rem;
    font-weight: 500;
    cursor: pointer;
    transition: .2s;
}

.btn-p {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: #fff;
}

.btn-p:hover {
    opacity: .85;
}

.btn-p:disabled {
    opacity: .4;
    cursor: default;
}

.btn-g {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-dim);
}

.btn-g:hover {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text);
}

.btn-sm {
    padding: .28rem .6rem;
    font-size: .72rem;
}

.btn-danger {
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: #f87171;
    background: transparent;
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.08);
}

select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    border-radius: 7px;
    padding: .35rem .6rem;
    font-family: inherit;
    font-size: .78rem;
    cursor: pointer;
    outline: none;
}

/* ── Prompt card node ── */
.c-node.node-prompt {
    background: #130d1e;
    border-color: rgba(139, 92, 246, 0.45);
    width: 220px;
}

.c-node.node-prompt .node-type {
    color: #a78bfa;
}

.c-node.node-prompt:hover {
    border-color: rgba(139, 92, 246, 0.8);
}

.c-node.node-prompt.selected {
    border-color: #a78bfa;
    box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.35), 0 0 28px rgba(139, 92, 246, 0.25);
}

/* Generate Text — yellow neon variant */
.c-node.prompt-text {
    background: #1a1608;
    border-color: rgba(251, 191, 36, 0.5);
}

.c-node.prompt-text .node-head {
    background: linear-gradient(135deg, rgba(120, 90, 10, 0.4), rgba(60, 45, 5, 0.2));
    border-bottom-color: rgba(251, 191, 36, 0.25);
}

.c-node.prompt-text .node-type {
    color: #fbbf24;
}

.c-node.prompt-text:hover {
    border-color: rgba(251, 191, 36, 0.85);
    box-shadow: 0 0 14px rgba(251, 191, 36, 0.12);
}

.c-node.prompt-text.selected {
    border-color: #fbbf24;
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.35), 0 0 28px rgba(251, 191, 36, 0.2);
}

.c-node.prompt-text .prompt-ta:focus {
    border-color: rgba(251, 191, 36, 0.5);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.1);
}

.c-node.prompt-text .run-btn {
    border-color: rgba(251, 191, 36, 0.3);
    color: #fbbf24;
}

.c-node.prompt-text .run-btn:hover {
    background: rgba(251, 191, 36, 0.12);
}

.prompt-body {
    padding: .6rem;
}

.prompt-ta {
    width: 100%;
    height: 88px;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 8px;
    padding: .5rem;
    color: var(--text);
    font-family: inherit;
    font-size: .78rem;
    resize: none;
    outline: none;
}

.prompt-ta:focus {
    border-color: rgba(139, 92, 246, 0.5);
}

.prompt-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: .5rem;
    gap: .4rem;
}

.prompt-foot select {
    flex: 1;
    font-size: .7rem;
    padding: .25rem .4rem;
}

.run-btn {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: .3rem .65rem;
    font-size: .72rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: .2s;
}

.run-btn:hover {
    opacity: .85;
}

.run-btn:disabled {
    opacity: .4;
    cursor: default;
}

/* ── Result card node ── */
.c-node.node-result {
    background: #0a1a14;
    border-color: rgba(52, 211, 153, 0.35);
}

.c-node.node-result .node-type {
    color: #34d399;
}

.c-node.node-result:hover {
    border-color: rgba(52, 211, 153, 0.65);
}

.c-node.node-result.selected {
    border-color: #34d399;
    box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.3), 0 0 24px rgba(52, 211, 153, 0.15);
}

.c-node.node-result .node-img {
    border-radius: 0 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px);
}

/* ── Canvases panel ── */
#canvasesPanel {
    position: fixed;
    top: 0;
    right: -340px;
    width: 320px;
    height: 100vh;
    background: rgba(10, 10, 18, 0.97);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.07);
    z-index: 600;
    transition: right .3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5);
}

#canvasesPanel.open {
    right: 0;
}

.cp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.cp-header h3 {
    font-size: .9rem;
    font-weight: 600;
}

.cp-header p {
    font-size: .7rem;
    color: var(--text-dim);
    margin-top: .1rem;
}

.cp-slots {
    flex: 1;
    overflow-y: auto;
    padding: .75rem;
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.cp-slot {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color .2s;
}

.cp-slot:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.cp-slot.filled {
    border-color: rgba(139, 92, 246, 0.2);
}

.cp-slot-top {
    display: flex;
    gap: .65rem;
    padding: .6rem;
    align-items: flex-start;
}

.cp-thumb {
    width: 52px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.cp-thumb-empty {
    width: 52px;
    height: 40px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: .8rem;
}

.cp-info {
    flex: 1;
    min-width: 0;
}

.cp-name {
    font-size: .8rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    width: 100%;
    outline: none;
}

.cp-name:focus {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding: 0 .25rem;
}

.cp-date {
    font-size: .66rem;
    color: var(--text-dim);
    margin-top: .2rem;
}

.cp-actions {
    display: flex;
    gap: .35rem;
    padding: 0 .6rem .6rem;
}

.cp-empty-label {
    padding: .85rem;
    text-align: center;
    color: var(--text-dim);
    font-size: .75rem;
}

.cp-save-here {
    width: 100%;
    text-align: center;
}

/* ── Result slot node (pre-placed output receptor) ── */
.c-node.node-result-slot {
    background: rgba(52, 211, 153, 0.03);
    border: 1.5px dashed rgba(52, 211, 153, 0.3);
}

.c-node.node-result-slot:hover {
    border-color: rgba(52, 211, 153, 0.55);
}

.c-node.node-result-slot .node-type {
    color: #6b7280;
}

.result-slot-body {
    height: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    color: #374151;
    font-size: .72rem;
}

.result-slot-body .rs-icon {
    font-size: 1.6rem;
    opacity: .45;
}

.result-slot-body .rs-label {
    color: var(--text-dim);
}

/* ── Text-expansion modal ── */
#textModal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 700;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

#textModal.open {
    display: flex;
}

.tm-box {
    background: rgba(14, 14, 24, 0.98);
    border: 1px solid rgba(52, 211, 153, 0.25);
    border-radius: 16px;
    width: min(680px, 92vw);
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.tm-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: .8rem;
    font-weight: 600;
    color: #6ee7b7;
}

.tm-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.1rem 1.25rem;
    font-size: .88rem;
    line-height: 1.6;
    color: #e8e8f2 !important; /* Force light text on dark bg */
    word-break: break-word;
}

.tm-body p {
    margin-bottom: 1rem;
}

.tm-body h1, .tm-body h2, .tm-body h3, .tm-body h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #fff;
    font-weight: 600;
}

.tm-body h3 { font-size: 1.1rem; }
.tm-body h2 { font-size: 1.25rem; }

.tm-body ul, .tm-body ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.tm-body li {
    margin-bottom: 0.5rem;
}

.tm-body::-webkit-scrollbar {
    width: 4px;
}

.tm-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

.tm-foot {
    display: flex;
    gap: .5rem;
    justify-content: flex-end;
    padding: .75rem 1.2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ── Node '+' contextual menu ── */
.node-add-btn {
    position: absolute;
    bottom: -13px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 22px;
    background: rgba(15, 15, 25, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    color: var(--text-dim);
    font-size: .85rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .15s, border-color .15s, color .15s;
    z-index: 20;
}

.c-node:hover .node-add-btn {
    opacity: 1;
}

.node-add-btn:hover {
    border-color: rgba(139, 92, 246, 0.6);
    color: var(--accent);
    background: rgba(139, 92, 246, 0.12);
}

#nodeMenu {
    position: fixed;
    z-index: 850;
    background: rgba(8, 8, 16, 0.97);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 10px;
    padding: .3rem;
    min-width: 148px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
    display: none;
}

#nodeMenu.open {
    display: block;
}

.nm-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .42rem .65rem;
    border-radius: 7px;
    cursor: pointer;
    font-size: .74rem;
    color: var(--text);
    transition: background .12s;
}

.nm-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.nm-icon {
    font-size: .8rem;
    width: 14px;
    text-align: center;
    opacity: .75;
}

/* ── In-card generation loading ── */
.card-gen-overlay {
    position: absolute;
    inset: 0;
    background: rgba(7, 7, 13, 0.88);
    backdrop-filter: blur(4px);
    border-radius: inherit;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .85rem;
    pointer-events: none;
}

.card-gen-label {
    font-size: .68rem;
    color: var(--text-dim);
    text-align: center;
}

.card-prog-wrap {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    overflow: hidden;
}

.card-prog-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #8b5cf6, #c084fc);
    border-radius: 999px;
    transition: width .35s ease;
    box-shadow: 0 0 6px rgba(139, 92, 246, 0.5);
}

.card-prog-pct {
    font-size: .65rem;
    color: var(--accent);
    font-weight: 600;
}

@keyframes card-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.3), 0 0 16px rgba(139, 92, 246, 0.1);
    }

    50% {
        box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.8), 0 0 28px rgba(139, 92, 246, 0.3);
    }
}

.c-node.generating {
    animation: card-pulse 1.5s ease-in-out infinite;
    border-color: var(--accent) !important;
}

/* ── Connection drop-zone half-shading ── */
.c-node.drop-left,
.c-node.drop-right {
    position: relative;
}

.c-node.drop-left::after,
.c-node.drop-right::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    z-index: 30;
    transition: opacity .1s;
}

/* Left half — input side (cyan tint) */
.c-node.drop-left {
    border-color: rgba(52, 211, 153, 0.7) !important;
    box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.4), 0 0 18px rgba(52, 211, 153, 0.2) !important;
}
.c-node.drop-left::after {
    background: linear-gradient(90deg, rgba(52, 211, 153, 0.18) 0%, transparent 55%);
}

/* Right half — output side (purple tint) */
.c-node.drop-right {
    border-color: rgba(139, 92, 246, 0.7) !important;
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.4), 0 0 18px rgba(139, 92, 246, 0.2) !important;
}
.c-node.drop-right::after {
    background: linear-gradient(90deg, transparent 45%, rgba(139, 92, 246, 0.18) 100%);
}



/* ── Minimap ── */
#minimap {
    position: absolute;
    bottom: 1.25rem;
    right: 1.25rem;
    width: 180px;
    height: 110px;
    border-radius: 10px;
    background: rgba(6, 6, 14, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45),
                0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    cursor: pointer;
    z-index: 30;
    transition: border-color .2s, box-shadow .2s;
    display: block;
}

#minimap:hover {
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.55),
                0 0 14px rgba(139, 92, 246, 0.12);
}

/* ── Floating Run All button ── */
#runAllBtn {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    padding: .55rem 1.6rem;
    border-radius: 999px;
    border: 1px solid rgba(74, 222, 128, 0.45);
    background: rgba(7, 7, 13, 0.82);
    backdrop-filter: blur(8px);
    color: #4ade80;
    font-family: inherit;
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .03em;
    cursor: pointer;
    box-shadow: 0 0 18px rgba(74, 222, 128, 0.12), 0 2px 12px rgba(0,0,0,0.4);
    transition: transform .15s, box-shadow .15s, background .15s;
}

#runAllBtn:hover {
    transform: translateX(-50%) translateY(-2px);
    background: rgba(10, 20, 12, 0.9);
    box-shadow: 0 0 28px rgba(74, 222, 128, 0.25), 0 4px 16px rgba(0,0,0,0.5);
}

#runAllBtn:active {
    transform: translateX(-50%) translateY(0px);
}

/* ── Resize node ── */
.node-resize {
    width: var(--node-w);
    border-color: rgba(56, 189, 248, 0.35) !important;
}

.node-resize .node-head {
    background: linear-gradient(135deg, rgba(12, 74, 110, 0.6), rgba(8, 47, 73, 0.3));
    border-bottom-color: rgba(56, 189, 248, 0.2);
}

.resize-type-label { color: #38bdf8 !important; }

.resize-body {
    padding: .85rem .75rem .75rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.resize-hint {
    font-size: .67rem;
    color: var(--text-dim);
    margin: 0;
}

.resize-ratios {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
}

.ratio-opt {
    display: flex;
    align-items: center;
    gap: .2rem;
    font-size: .65rem;
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: .2rem .4rem;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    transition: background .1s;
}

.ratio-opt:hover { background: rgba(255, 255, 255, 0.1); }

.ratio-opt input {
    margin: 0;
    accent-color: #38bdf8;
    cursor: pointer;
}

/* ── Multi-Result node ── */
.node-multi-result {
    width: 240px;
    border-color: rgba(52, 211, 153, 0.35) !important;
}

.mr-head-actions {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin-left: auto;
}

.mr-download-all {
    font-size: .62rem !important;
    padding: .18rem .45rem !important;
    opacity: .85;
    transition: opacity .15s;
}
.mr-download-all:hover { opacity: 1; }


.mr-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: .5rem;
    max-height: 420px;
    overflow-y: auto;
}

.mr-list::-webkit-scrollbar {
    width: 3px;
}

.mr-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.mr-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: rgba(255, 255, 255, 0.03);
    padding: .4rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.mr-img-wrap {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background: #000;
}

.mr-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.mr-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: .4rem;
}

.mr-ratio {
    font-size: .65rem;
    color: var(--text-dim);
    font-weight: 500;
    background: rgba(0, 0, 0, 0.2);
    align-self: flex-start;
    padding: .15rem .4rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.mr-actions {
    display: flex;
    gap: .3rem;
}

.mr-actions .btn {
    padding: .2rem .4rem;
    font-size: .65rem;
    flex: 1;
}

/* ── Start node ── */
.node-start {
    width: 200px;
    border-color: rgba(74, 222, 128, 0.35) !important;
    box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.15), 0 4px 24px rgba(74, 222, 128, 0.08) !important;
}

.node-start .node-head {
    background: linear-gradient(135deg, rgba(20,60,30,0.6), rgba(10,30,20,0.3));
    border-bottom-color: rgba(74, 222, 128, 0.2);
}

.start-type-label { color: #4ade80 !important; }

.start-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    padding: .85rem .75rem .75rem;
}

.start-hint {
    font-size: .67rem;
    color: var(--text-dim);
    text-align: center;
    margin: 0;
    line-height: 1.4;
}

.flow-status {
    font-size: .65rem;
    color: #4ade80;
    min-height: .85rem;
    text-align: center;
}

.flow-run-btn {
    width: 100%;
    padding: .4rem .6rem;
    border-radius: 7px;
    border: 1px solid rgba(74, 222, 128, 0.4);
    background: rgba(74, 222, 128, 0.1);
    color: #4ade80;
    font-family: inherit;
    font-size: .74rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
}

.flow-run-btn:hover:not(:disabled) {
    background: rgba(74, 222, 128, 0.2);
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.2);
}

.flow-run-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Flow execution states */
.node-start.flow-running {
    border-color: rgba(74, 222, 128, 0.8) !important;
    box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.4),
                0 0 24px rgba(74, 222, 128, 0.25) !important;
    animation: startPulse 1.2s ease-in-out infinite;
}

.node-start.flow-warn {
    border-color: rgba(251, 191, 36, 0.7) !important;
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.3) !important;
}

/* Active prompt node during flow */
.node-prompt.flow-active {
    border-color: rgba(74, 222, 128, 0.7) !important;
    box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.35),
                0 0 18px rgba(74, 222, 128, 0.15) !important;
}

@keyframes startPulse {
    0%, 100% { box-shadow: 0 0 0 1px rgba(74,222,128,0.4), 0 0 18px rgba(74,222,128,0.15) !important; }
    50%       { box-shadow: 0 0 0 1px rgba(74,222,128,0.8), 0 0 32px rgba(74,222,128,0.35) !important; }
}

/* ── Empty-state abstract morphing blobs ── */
#bubblesLayer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

#bubblesLayer.hiding {
    animation: bubbleFadeOut 0.7s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}

#bubblesLayer.showing {
    animation: bubbleFadeIn 0.8s cubic-bezier(0.2, 0, 0.4, 1) forwards;
}

@keyframes bubbleFadeOut {
    0%   { opacity: 1; transform: scale(1);    }
    100% { opacity: 0; transform: scale(1.04); }
}

@keyframes bubbleFadeIn {
    0%   { opacity: 0; transform: scale(1.04); }
    100% { opacity: 1; transform: scale(1);    }
}

.bubble {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--s);
    height: var(--s);

    /* Start already non-circular */
    border-radius: 62% 38% 46% 54% / 57% 43% 57% 43%;

    /* Soft colour glow — more visible */
    background: radial-gradient(ellipse at 45% 40%,
        hsla(var(--hue), 90%, 72%, 0.55) 0%,
        hsla(var(--hue), 75%, 55%, 0.25) 45%,
        transparent 75%);

    /* Variable blur: set --blur per bubble in HTML */
    filter: blur(var(--blur, 18px));
    mix-blend-mode: screen;
    opacity: 0.85;

    animation: morphblob var(--dur, 18s) cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
    animation-delay: var(--delay, 0s);
    will-change: transform, border-radius;
}

/* No specular highlight — fully abstract */
.bubble::before { display: none; }

@keyframes morphblob {
    0%   {
        transform: translate(0px, 0px) scale(1) rotate(0deg);
        border-radius: 62% 38% 46% 54% / 57% 43% 57% 43%;
    }
    14%  {
        transform: translate(22px, -68px) scale(1.14) rotate(12deg);
        border-radius: 38% 62% 72% 28% / 65% 30% 70% 35%;
    }
    28%  {
        transform: translate(-18px, -125px) scale(0.88) rotate(-8deg);
        border-radius: 74% 26% 38% 62% / 42% 62% 38% 58%;
    }
    42%  {
        transform: translate(35px, -88px) scale(1.18) rotate(20deg);
        border-radius: 32% 68% 58% 42% / 58% 42% 62% 38%;
    }
    57%  {
        transform: translate(-28px, -148px) scale(0.85) rotate(-14deg);
        border-radius: 58% 42% 30% 70% / 38% 68% 32% 62%;
    }
    71%  {
        transform: translate(14px, -98px) scale(1.10) rotate(6deg);
        border-radius: 42% 58% 66% 34% / 62% 38% 58% 42%;
    }
    86%  {
        transform: translate(-22px, -55px) scale(0.93) rotate(-18deg);
        border-radius: 68% 32% 44% 56% / 46% 58% 42% 54%;
    }
    100% {
        transform: translate(0px, 0px) scale(1) rotate(0deg);
        border-radius: 62% 38% 46% 54% / 57% 43% 57% 43%;
    }
}

/* ── Token area — "add more" button ── */
.token-area {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    position: relative;
}

.add-more-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.68rem;
    font-family: inherit;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
}
.add-more-btn:hover { text-decoration: underline; }

/* Show on hover over the token area */
.token-area:hover .add-more-btn { opacity: 1; }

/* Always show when 0 credits */
.add-more-btn.always-visible { opacity: 1; }

/* ── Redeem voucher modal ── */
.redeem-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.redeem-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.redeem-modal {
    background: #14141f;
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 16px;
    padding: 2rem 2.25rem;
    width: 360px;
    max-width: 90vw;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.redeem-modal h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.redeem-sub {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-bottom: 1.25rem;
}

.redeem-input {
    width: 100%;
    padding: 0.6rem 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text);
    font-family: monospace;
    font-size: 0.95rem;
    text-align: center;
    letter-spacing: 2px;
    text-transform: uppercase;
    outline: none;
    transition: border-color 0.2s;
}
.redeem-input:focus {
    border-color: rgba(139, 92, 246, 0.4);
}

.redeem-msg {
    font-size: 0.78rem;
    min-height: 1.2em;
    margin-top: 0.6rem;
}
.redeem-msg.error { color: #ff4444; }
.redeem-msg.success { color: #4ade80; }

.redeem-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    margin-top: 1.25rem;
}

/* Profile components migrated to shared.css */

/* ── Admin login form & auth card layout ─────────────────────────────── */

/* Google button: full width inside card */
.auth-card .btn-p {
    width: 100%;
    padding: .7rem 1rem;
    font-size: .85rem;
    font-weight: 600;
    letter-spacing: .01em;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    box-shadow: 0 4px 18px rgba(109,40,217,.35);
    transition: opacity .18s, box-shadow .18s;
}
.auth-card .btn-p:hover {
    opacity: .9;
    box-shadow: 0 6px 24px rgba(109,40,217,.5);
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: .65rem;
    width: 100%;
    color: rgba(255,255,255,0.22);
    font-size: .7rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.07);
}

/* Admin form */
#adminLoginForm {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    width: 100%;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    width: 100%;
}

.auth-field label {
    font-size: .72rem;
    color: rgba(255,255,255,0.45);
    font-weight: 500;
    letter-spacing: .03em;
    padding-left: .15rem;
}

.auth-field input {
    width: 100%;
    background: rgba(255,255,255,0.055);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: .65rem .85rem;
    color: var(--text);
    font-family: inherit;
    font-size: .88rem;
    outline: none;
    transition: border-color .2s, background .2s, box-shadow .2s;
    box-sizing: border-box;
}
.auth-field input::placeholder { color: rgba(255,255,255,0.2); }

.auth-field input:focus {
    border-color: rgba(139,92,246,0.55);
    background: rgba(139,92,246,0.07);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.12);
}

.btn-admin {
    width: 100%;
    background: linear-gradient(135deg, rgba(139,92,246,0.22), rgba(109,40,217,0.18));
    border: 1px solid rgba(139,92,246,0.4);
    color: #d8b4fe;
    border-radius: 10px;
    padding: .7rem;
    font-family: inherit;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, border-color .2s, box-shadow .2s, color .2s;
    letter-spacing: .02em;
    margin-top: .15rem;
    box-shadow: 0 2px 12px rgba(109,40,217,.18);
    box-sizing: border-box;
}

.btn-admin:hover {
    background: linear-gradient(135deg, rgba(139,92,246,0.38), rgba(109,40,217,0.32));
    border-color: rgba(139,92,246,0.7);
    color: #fff;
    box-shadow: 0 4px 20px rgba(109,40,217,.3);
}
/* ══════════════════════════════════════════════════════════════════════════════
   HIKE THEME OVERRIDES — canvas.css
   ══════════════════════════════════════════════════════════════════════════════ */

/* Hike tokens → see /css/hike-tokens.css (single source of truth) */

[data-theme="hike"] body {
    background: var(--bg-color);
    color: var(--text-primary);
}

/* Header — overridden by dark anchor bar below */

[data-theme="hike"] #toolbar,
[data-theme="hike"] #popToolbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.09);
}

[data-theme="hike"] .btn-g {
    background: #FFFFFF;
    border-color: rgba(0, 0, 0, 0.09);
    color: #3F3F46;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

[data-theme="hike"] .btn-g:hover {
    background: #F5F4F1;
    border-color: rgba(0, 0, 0, 0.18);
    color: #18181B;
}

[data-theme="hike"] #workspace,
[data-theme="hike"] #popWorkspace {
    background:
        linear-gradient(rgba(0,0,0,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.025) 1px, transparent 1px);
    background-color: #FAFAF8;
    background-size: 32px 32px;
}

/* ══════════════════════════════════════════════════════════════════════
   HIKE MODE — Node System
   Design: White cards with colored left-border accents per node type.
   Palette: Deep desaturated tones — emerald, indigo, amber, teal, steel.
   ══════════════════════════════════════════════════════════════════════ */

/* ── Base Node Card ── */
[data-theme="hike"] .c-node {
    background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.09);
    border-left: 3px solid #D4D4D8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    border-radius: 10px;
}
[data-theme="hike"] .c-node:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
}
[data-theme="hike"] .c-node.selected {
    border-color: rgba(139, 105, 20, 0.35);
    box-shadow: 0 0 0 2px rgba(139,105,20,0.12), 0 4px 12px rgba(0,0,0,0.07);
}

/* ── Node Headers ── */
[data-theme="hike"] .node-head {
    background: #FAFAF8;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: .5rem .75rem;
    border-radius: 10px 10px 0 0;
}

/* ── Per-Type Left Border Accents ── */
[data-theme="hike"] .c-node.node-start   { border-left-color: #059669; }
[data-theme="hike"] .c-node.node-image   { border-left-color: #64748B; }
[data-theme="hike"] .c-node.node-prompt  { border-left-color: #4F46E5; }
[data-theme="hike"] .c-node.prompt-text  { border-left-color: #D97706; }
[data-theme="hike"] .c-node.node-result,
[data-theme="hike"] .c-node.node-result-slot { border-left-color: #0D9488; }
[data-theme="hike"] .c-node.node-resize  { border-left-color: #2563EB; }
[data-theme="hike"] .c-node.node-results { border-left-color: #7C3AED; }

/* ── Per-Type Label Colors (matching the left border) ── */
[data-theme="hike"] .start-type-label             { color: #059669; }
[data-theme="hike"] .c-node.node-image .node-type  { color: #475569; }
[data-theme="hike"] .c-node.node-prompt .node-type  { color: #4F46E5; }
[data-theme="hike"] .c-node.prompt-text .node-type  { color: #D97706; }
[data-theme="hike"] .c-node.node-result .node-type,
[data-theme="hike"] .c-node.node-result-slot .node-type { color: #0D9488; }
[data-theme="hike"] .resize-type-label              { color: #2563EB; }

/* ── Fallback label color ── */
[data-theme="hike"] .node-type {
    color: #3F3F46;
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* ── Run Buttons — color-matched to node type ── */
[data-theme="hike"] .flow-run-btn {
    background: #059669; color: #fff;
    border: none; border-radius: 6px;
    padding: .35rem .7rem; font-size: .65rem; font-weight: 600;
}
[data-theme="hike"] .flow-run-btn:hover { background: #047857; }

[data-theme="hike"] .c-node.node-prompt .run-btn {
    background: #4F46E5; color: #fff;
    border: none; border-radius: 6px;
    font-weight: 600;
}
[data-theme="hike"] .c-node.node-prompt .run-btn:hover { background: #4338CA; }

[data-theme="hike"] .c-node.prompt-text .run-btn {
    background: #D97706; color: #fff;
    border: none; border-radius: 6px;
    font-weight: 600;
}
[data-theme="hike"] .c-node.prompt-text .run-btn:hover { background: #B45309; }

[data-theme="hike"] .c-node.node-resize .run-btn {
    background: #2563EB; color: #fff;
    border: none; border-radius: 6px;
    font-weight: 600;
}
[data-theme="hike"] .c-node.node-resize .run-btn:hover { background: #1D4ED8; }

/* Fallback for .btn-p */
[data-theme="hike"] .btn-p {
    background: var(--hike-header, #1C1917); color: #fff;
    border: none; border-radius: 8px;
    padding: .3rem .6rem; font-size: .65rem; font-weight: 500;
}
[data-theme="hike"] .btn-p:hover { background: #292524; }

/* ── Inputs ── */
[data-theme="hike"] .node-prompt-body textarea {
    background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.09);
    color: #18181B;
    border-radius: 8px;
}
[data-theme="hike"] .node-prompt-body textarea:focus {
    border-color: rgba(139, 105, 20, 0.4);
    box-shadow: 0 0 0 3px rgba(139,105,20,0.12);
}

/* ── Toolbar Buttons ── */
[data-theme="hike"] .btn-g,
[data-theme="hike"] .pop-tool-btn {
    background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.09);
    color: #3F3F46;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
[data-theme="hike"] .btn-g:hover,
[data-theme="hike"] .pop-tool-btn:hover {
    background: #F5F4F1;
    border-color: rgba(0, 0, 0, 0.18);
    color: #18181B;
}
[data-theme="hike"] .btn-danger {
    background: #FFFFFF;
    border: 1px solid #FECACA;
    color: #DC2626;
}
[data-theme="hike"] .btn-danger:hover {
    background: #FEF2F2;
    border-color: #FCA5A5;
}

/* ── Run All — prominent dark button ── */
[data-theme="hike"] #runAllBtn {
    background: var(--hike-header, #1C1917);
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(28,25,23,0.25);
    border: none;
    font-weight: 500;
}
[data-theme="hike"] #runAllBtn:hover {
    background: #292524;
    box-shadow: 0 6px 20px rgba(28,25,23,0.35);
    transform: translateY(-1px);
}






/* TEST MODE badge on dark header */
[data-theme="hike"] .test-badge {
    background: rgba(251,191,36,0.15);
    color: #FCD34D;
    border-color: rgba(251,191,36,0.3);
}

/* Image empty state */
[data-theme="hike"] .node-img-empty {
    border-bottom-color: rgba(0,0,0,0.04);
}
[data-theme="hike"] .node-img-empty:hover {
    background: rgba(0,0,0,0.02);
}
[data-theme="hike"] .img-add-btn,
[data-theme="hike"] .img-change-btn,
[data-theme="hike"] .res-action-btn {
    background: #FFFFFF;
    border-color: rgba(0, 0, 0, 0.09);
    color: #3F3F46;
}
[data-theme="hike"] .img-add-btn:hover,
[data-theme="hike"] .img-change-btn:hover,
[data-theme="hike"] .res-action-btn:hover {
    background: #F5F4F1;
    border-color: rgba(0, 0, 0, 0.18);
}

/* ── Connections ── */
[data-theme="hike"] .c-path {
    stroke: var(--conn);
    stroke-dasharray: none; /* Solid clean lines */
}

[data-theme="hike"] .c-path:hover {
    stroke: #9CA3AF;
}

[data-theme="hike"] .c-temp {
    stroke: #9CA3AF;
    stroke-dasharray: none;
}

[data-theme="hike"] .c-path-selected {
    stroke: #EF4444;
    stroke-dasharray: none;
}

/* Bubbles adapt */
[data-theme="hike"] .bubble {
    --hue: 0;
    opacity: 0.15;
    filter: blur(var(--blur)) saturate(0);
}

/* Minimap */
[data-theme="hike"] #minimap {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.09);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

/* ══════════════════════════════════════════════════════════════════════════════
   THEME TOGGLE BUTTON  (TEST MODE — top-right pill) - COPIED FROM style.css
   ══════════════════════════════════════════════════════════════════════════════ */

/* Theme toggle migrated to shared.css */

/* TEST MODE badge */
.test-badge {
    display: inline-block;
    font-size: 0.5rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(244,235,51,0.15);
    color: #F4EB33;
    border: 1px solid rgba(244,235,51,0.3);
    margin-left: 2px;
    vertical-align: middle;
}

[data-theme="hike"] .test-badge {
    background: rgba(139,105,20,0.08);
    color: #8B6914;
    border-color: rgba(139,105,20,0.2);
}

/* ── Video card node ── */
.c-node.node-video {
    background: #1e0d16;
    border-color: rgba(225, 29, 72, 0.45);
    width: 240px;
}

.c-node.node-video .node-type {
    color: #fda4af;
}

.c-node.node-video:hover {
    border-color: rgba(225, 29, 72, 0.8);
}

.c-node.node-video.selected {
    border-color: #fda4af;
    box-shadow: 0 0 0 1px rgba(253, 164, 175, 0.35), 0 0 28px rgba(225, 29, 72, 0.25);
}

.video-body {
    padding: .65rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.video-body textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: .5rem;
    color: var(--text);
    font-family: inherit;
    font-size: .75rem;
    resize: none;
    height: 70px;
    outline: none;
}

.video-body textarea:focus {
    border-color: rgba(225, 29, 72, 0.4);
}

/* Mode toggle for video node */
.video-mode-toggle {
    display: flex;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.video-mode-toggle .mode-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 4px 0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.video-mode-toggle .mode-btn:hover {
    color: var(--text);
}

.video-mode-toggle .mode-btn.active {
    background: rgba(225, 29, 72, 0.2);
    color: #fda4af;
    border: 1px solid rgba(225, 29, 72, 0.35);
}

/* Video preview inside node */
.video-preview-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.video-preview {
    border-radius: 6px;
    max-height: 140px;
    object-fit: cover;
}

.video-download-btn {
    width: 100%;
    background: rgba(225, 29, 72, 0.15);
    border: 1px solid rgba(225, 29, 72, 0.3);
    color: #fda4af;
    border-radius: 6px;
    padding: 5px;
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.video-download-btn:hover {
    background: rgba(225, 29, 72, 0.25);
    box-shadow: 0 0 8px rgba(225, 29, 72, 0.2);
}

/* Hike theme overrides for video node */
[data-theme="hike"] .c-node.node-video {
    background: #FFF5F5;
    border-color: rgba(225, 29, 72, 0.3);
}

[data-theme="hike"] .c-node.node-video .node-type {
    color: #E11D48;
}

[data-theme="hike"] .c-node.node-video:hover {
    border-color: rgba(225, 29, 72, 0.6);
}

[data-theme="hike"] .c-node.node-video.selected {
    border-color: #E11D48;
    box-shadow: 0 0 0 1px rgba(225, 29, 72, 0.25), 0 4px 14px rgba(225, 29, 72, 0.12);
}

[data-theme="hike"] .video-mode-toggle {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="hike"] .video-mode-toggle .mode-btn {
    color: #71717A;
}

[data-theme="hike"] .video-mode-toggle .mode-btn.active {
    background: rgba(225, 29, 72, 0.08);
    color: #E11D48;
    border-color: rgba(225, 29, 72, 0.2);
}

[data-theme="hike"] .video-body textarea {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="hike"] .video-body textarea:focus {
    border-color: rgba(225, 29, 72, 0.4);
}

[data-theme="hike"] .video-download-btn {
    background: #E11D48;
    border-color: #E11D48;
    color: #fff;
}

[data-theme="hike"] .video-download-btn:hover {
    background: #BE123C;
}

/* Hike theme overrides for contextual node menu */
[data-theme="hike"] #nodeMenu {
    background: #FFFFFF;
    border-color: rgba(0, 0, 0, 0.09);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

[data-theme="hike"] .nm-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* ── Node Corner Resize Handle ── */
.c-resize-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    bottom: 0;
    right: 0;
    cursor: nwse-resize;
    z-index: 10;
    background: transparent;
    border-bottom: 3px solid var(--accent);
    border-right: 3px solid var(--accent);
    border-bottom-right-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.c-node:hover .c-resize-handle,
.c-node.selected .c-resize-handle {
    opacity: 0.7;
}

.c-resize-handle:hover {
    opacity: 1 !important;
}

/* ── Flex Layout Overrides for Canvas Node Scaling ── */
.c-node {
    display: flex;
    flex-direction: column;
    min-width: 160px;
    min-height: 80px;
}

.c-node .node-head {
    flex-shrink: 0;
}

.prompt-body,
.video-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.prompt-ta,
.video-body textarea {
    flex: 1 1 auto;
    height: 100% !important;
    min-height: 40px;
}

.c-node .node-img {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    object-fit: contain;
    min-height: 50px;
}

/* ── Creativos Import Panel ──────────────────────────────── */
.creativos-import-panel {
    position: fixed;
    top: 0;
    right: -380px;
    width: 370px;
    height: 100vh;
    background: var(--bg, #0a0a0a);
    border-left: 1px solid var(--node-border, rgba(255,255,255,0.08));
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    box-shadow: -4px 0 24px rgba(0,0,0,0.3);
}
.creativos-import-panel.open {
    right: 0;
}
.creativos-import-panel .crv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--node-border, rgba(255,255,255,0.08));
}
.creativos-import-panel .crv-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text, #fff);
}
.creativos-import-panel .crv-close {
    background: none;
    border: none;
    color: var(--text-dim, #aaa);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
}
.creativos-import-panel .crv-close:hover {
    background: rgba(255,255,255,0.06);
}
.creativos-import-panel .crv-filters {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--node-border, rgba(255,255,255,0.08));
}
.creativos-import-panel .crv-filter {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--node-border, rgba(255,255,255,0.1));
    color: var(--text-dim, #aaa);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}
.creativos-import-panel .crv-filter.active {
    background: var(--accent, #7c3aed);
    color: #fff;
    border-color: var(--accent, #7c3aed);
}
.creativos-import-panel .crv-grid {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    align-content: start;
}
.creativos-import-panel .crv-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--node-border, rgba(255,255,255,0.08));
    aspect-ratio: 1;
}
.creativos-import-panel .crv-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.creativos-import-panel .crv-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 40%, rgba(0,0,0,0.85));
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}
.creativos-import-panel .crv-item:hover .crv-item-overlay {
    opacity: 1;
}
.creativos-import-panel .crv-item-prompt {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.7);
    margin-bottom: 6px;
    line-height: 1.3;
}
.creativos-import-panel .crv-import-btn {
    background: var(--accent, #7c3aed);
    color: #fff;
    border: none;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.creativos-import-panel .crv-import-btn:hover {
    filter: brightness(1.15);
}
.creativos-import-panel .crv-import-btn:disabled {
    opacity: 0.5;
    cursor: default;
}
.creativos-import-panel .crv-loading,
.creativos-import-panel .crv-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim, #aaa);
    font-size: 0.85rem;
}
