/* =========================================================================
   EFL Full Studio — dynamic node-graph engine styles (.efl-g-*)
   Coexists with public.css (which styles the shell). Canonical dark palette
   (Image Studio) + light overrides via html[data-theme="light"].
   ========================================================================= */
.efl-fs {
	--g-bg: #070b15;
	--g-node: #0a0e1f;
	--g-node-2: #0d1226;
	--g-line: rgba(255, 255, 255, .10);
	--g-text: #e8ecf7;
	--g-muted: rgba(232, 236, 247, .58);
	--g-cyan: #00efff;
	--g-purple: #8d4dff;
	--g-pink: #ff5db1;
	--g-grad: linear-gradient(135deg, #4f6dfb, #8d4dff 55%, #ff5db1);
	--g-ok: #34d399;
	--g-amber: #fbbf24;
	--g-red: #f87171;
}

/* ---- Node ---- */
.efl-g-node {
	position: absolute;
	width: 248px;
	background: linear-gradient(180deg, var(--g-node-2), var(--g-node));
	border: 1px solid var(--g-line);
	border-radius: 16px;
	box-shadow: 0 24px 60px -28px rgba(0, 0, 0, .8);
	color: var(--g-text);
	user-select: none;
	cursor: grab;
	transition: border-color .15s ease, box-shadow .2s ease, transform .12s ease;
}
.efl-g-node:active { cursor: grabbing; }
.efl-g-node.is-selected { border-color: rgba(141, 77, 255, .8); box-shadow: 0 0 0 1px rgba(141, 77, 255, .5), 0 28px 70px -26px rgba(141, 77, 255, .5); }
.efl-g-node.is-running { border-color: rgba(0, 239, 255, .55); }
.efl-g-node.is-done { border-color: rgba(52, 211, 153, .4); }
.efl-g-node.is-error { border-color: rgba(248, 113, 113, .5); }

/* role accent strip on the left edge */
.efl-g-node::before {
	content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 3px;
	background: var(--g-muted); opacity: .7;
}
.efl-g-node--project::before { background: var(--g-grad); opacity: 1; }
.efl-g-node--input::before { background: linear-gradient(180deg, #38bdf8, #4f6dfb); }
.efl-g-node--operation::before { background: linear-gradient(180deg, #8d4dff, #ff5db1); }
.efl-g-node--output::before { background: linear-gradient(180deg, #34d399, #00efff); }
.efl-g-node--util::before { background: rgba(255, 255, 255, .25); }

.efl-g-node-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px 8px 18px; }
.efl-g-node-kind { font-size: 13px; font-weight: 700; letter-spacing: .01em; }
.efl-g-node-body { padding: 0 14px 12px 18px; font-size: 12px; min-height: 18px; }
.efl-g-kv { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; }
.efl-g-kv span { color: var(--g-muted); }
.efl-g-kv b { font-weight: 600; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.efl-g-snip { margin: 2px 0 0; color: var(--g-text); line-height: 1.5; }
.efl-g-muted { margin: 2px 0 0; color: var(--g-muted); }
.efl-g-err { margin: 2px 0 0; color: var(--g-red); }

.efl-g-node-act {
	display: block; width: calc(100% - 28px); margin: 0 14px 14px 14px;
	border: 1px solid var(--g-line); background: rgba(255, 255, 255, .04); color: var(--g-text);
	font-size: 12px; font-weight: 650; padding: 8px 10px; border-radius: 10px; cursor: pointer;
	transition: background .15s ease, border-color .15s ease;
}
.efl-g-node-act:hover { background: rgba(141, 77, 255, .16); border-color: rgba(141, 77, 255, .6); }

.efl-g-pill { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.efl-g-pill--running { color: var(--g-cyan); background: rgba(0, 239, 255, .14); }
.efl-g-pill--done { color: var(--g-ok); background: rgba(52, 211, 153, .14); }
.efl-g-pill--error { color: var(--g-red); background: rgba(248, 113, 113, .14); }

/* ---- Ports ---- */
.efl-g-port {
	position: absolute; top: 50%; width: 15px; height: 15px; margin-top: -7.5px;
	border-radius: 50%; background: var(--g-node); border: 2px solid var(--g-purple); z-index: 2;
	transition: transform .12s ease, box-shadow .12s ease;
}
.efl-g-port--in { left: -8px; border-color: #4f6dfb; }
.efl-g-port--out { right: -8px; cursor: crosshair; }
.efl-g-port--out:hover { transform: scale(1.25); box-shadow: 0 0 0 5px rgba(141, 77, 255, .22); }

/* ---- Wires ---- */
.efl-g-wire { fill: none; stroke: url(#efl-g-grad); stroke-width: 2.5; opacity: .45; }
.efl-g-wire.is-active { opacity: 1; stroke-width: 3; filter: drop-shadow(0 0 6px rgba(141, 77, 255, .5)); }
.efl-g-wire.is-pending { opacity: .9; stroke-dasharray: 7 6; }

/* ---- The transformation moment ---- */
@keyframes efl-g-mutate {
	0% { box-shadow: 0 0 0 0 rgba(0, 239, 255, .0), 0 24px 60px -28px rgba(0, 0, 0, .8); }
	40% { box-shadow: 0 0 0 6px rgba(0, 239, 255, .28), 0 0 40px 6px rgba(141, 77, 255, .45); }
	100% { box-shadow: 0 0 0 0 rgba(0, 239, 255, .0), 0 24px 60px -28px rgba(0, 0, 0, .8); }
}
.efl-g-node.is-mutating { animation: efl-g-mutate 1.1s ease-in-out infinite; }
.efl-g-node.is-mutating::after {
	content: ""; position: absolute; inset: -1px; border-radius: 16px; pointer-events: none;
	background: linear-gradient(120deg, transparent, rgba(0, 239, 255, .12), transparent);
	background-size: 220% 100%; animation: efl-g-sheen 1.1s linear infinite;
}
@keyframes efl-g-sheen { 0% { background-position: 220% 0; } 100% { background-position: -120% 0; } }

/* ---- Create menu (Unreal-style) ---- */
.efl-g-menu {
	position: fixed; z-index: 2147483600; width: 240px; max-height: 320px; display: flex; flex-direction: column;
	background: #0b1022; border: 1px solid var(--g-line); border-radius: 12px;
	box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .85); overflow: hidden;
	animation: efl-g-pop .12s ease;
}
@keyframes efl-g-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.efl-g-menu-search {
	margin: 8px; padding: 8px 10px; border: 1px solid var(--g-line); border-radius: 8px;
	background: rgba(255, 255, 255, .05); color: var(--g-text); font-size: 13px; font-family: inherit; outline: none;
}
.efl-g-menu-search:focus { border-color: var(--g-purple); }
.efl-g-menu-list { overflow-y: auto; padding: 0 6px 8px; scrollbar-width: thin; }
.efl-g-menu-item {
	display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
	border: 0; background: transparent; color: var(--g-text); font-size: 13px; padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.efl-g-menu-item:hover { background: rgba(141, 77, 255, .16); }
.efl-g-menu-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; background: var(--g-muted); }
.efl-g-menu-dot--input { background: #4f6dfb; }
.efl-g-menu-dot--operation { background: #8d4dff; }
.efl-g-menu-dot--output { background: #34d399; }
.efl-g-menu-dot--util { background: rgba(255, 255, 255, .4); }

/* ---- Inspector additions ---- */
.efl-g-field { display: block; margin-bottom: 12px; }
.efl-g-field > span { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--g-muted); margin-bottom: 6px; }
.efl-g-field input, .efl-g-field select, .efl-g-field textarea {
	width: 100%; box-sizing: border-box; border: 1px solid var(--g-line); border-radius: 9px;
	background: rgba(255, 255, 255, .05); color: var(--g-text); font-size: 13px; padding: 9px 11px; font-family: inherit; resize: vertical;
}
.efl-g-field input:focus, .efl-g-field select:focus, .efl-g-field textarea:focus { outline: none; border-color: var(--g-purple); box-shadow: 0 0 0 3px rgba(141, 77, 255, .18); }
.efl-g-run { width: 100%; margin-top: 2px; }
.efl-g-result { margin-top: 12px; }
.efl-g-result label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--g-muted); margin-bottom: 6px; }
.efl-g-result-box { white-space: pre-wrap; font-size: 12.5px; line-height: 1.55; color: var(--g-text); background: rgba(255, 255, 255, .04); border: 1px solid var(--g-line); border-radius: 10px; padding: 11px 12px; max-height: 260px; overflow: auto; scrollbar-width: thin; }
.efl-g-note { font-size: 12.5px; color: var(--g-muted); line-height: 1.5; margin: 0 0 12px; }
.efl-g-del { width: 100%; margin-top: 8px; color: var(--g-red); border-color: rgba(248, 113, 113, .4); background: transparent; }
.efl-g-del:hover { background: rgba(248, 113, 113, .12); }

/* ---- Toast ---- */
.efl-g-toast {
	position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px); z-index: 2147483600;
	background: #0b1022; border: 1px solid var(--g-line); color: var(--g-text);
	font-size: 13px; padding: 11px 18px; border-radius: 11px; box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .8);
	opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; max-width: 80vw;
}
.efl-g-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.efl-g-toast.is-err { border-color: rgba(248, 113, 113, .5); }

/* ---- Opt-in overlay (sits over the classic canvas; hidden until toggled) ---- */
.efl-g-overlay { position: absolute; inset: 0; display: none; z-index: 5; }
.efl-g-overlay.is-on { display: block; background: radial-gradient(circle at 20% 20%, rgba(141, 77, 255, .08), transparent 50%), var(--g-bg); }
.efl-g-overlay .efl-g-world { position: absolute; top: 0; left: 0; transform-origin: 0 0; width: 1px; height: 1px; }
.efl-g-overlay .efl-g-links { position: absolute; top: 0; left: 0; width: 6000px; height: 4000px; overflow: visible; pointer-events: none; }
.efl-g-overlay .efl-g-nodes { position: absolute; top: 0; left: 0; }
.efl-g-emptyhint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; font-size: 13px; color: var(--g-muted); pointer-events: none; max-width: 340px; }
.efl-g-toggle.is-on { background: linear-gradient(135deg, #4f6dfb, #8d4dff 55%, #ff5db1); border: 0; color: #fff; }

/* ---- Resize handle (bottom-right corner) ---- */
.efl-g-resize {
	position: absolute; right: 3px; bottom: 3px; width: 16px; height: 16px; cursor: nwse-resize; z-index: 3;
	opacity: 0; transition: opacity .12s ease;
	background:
		linear-gradient(135deg, transparent 0 50%, var(--g-muted) 50% 60%, transparent 60% 70%, var(--g-muted) 70% 80%, transparent 80%);
	border-bottom-right-radius: 14px;
}
.efl-g-node:hover .efl-g-resize, .efl-g-node.is-selected .efl-g-resize { opacity: .85; }

/* ---- Fullscreen (maximize the canvas + inspector; hide chrome) ---- */
.efl-fs:fullscreen {
	background: var(--g-bg); display: flex; flex-direction: column; padding: 14px; gap: 12px; overflow: hidden;
}
html[data-theme="light"] .efl-fs:fullscreen { background: #eef1f8; }
.efl-fs:fullscreen .efl-fs-bar, .efl-fs:fullscreen .efl-fs-bottom { display: none; }
.efl-fs:fullscreen .efl-fs-board { flex: 1 1 auto; min-height: 0; }
.efl-fs.is-fs .efl-fs-canvas { border-radius: 12px; }

/* ---- Light theme ---- */
html[data-theme="light"] .efl-fs {
	--g-bg: #eef1f8; --g-node: #ffffff; --g-node-2: #f7f9ff;
	--g-line: rgba(20, 28, 56, .12); --g-text: #1b2440; --g-muted: rgba(27, 36, 64, .58);
}
html[data-theme="light"] .efl-g-node-act { background: rgba(20, 28, 56, .03); }
html[data-theme="light"] .efl-g-node-act:hover { background: rgba(141, 77, 255, .12); }
html[data-theme="light"] .efl-g-menu { background: #ffffff; }
html[data-theme="light"] .efl-g-menu-search,
html[data-theme="light"] .efl-g-field input,
html[data-theme="light"] .efl-g-field select,
html[data-theme="light"] .efl-g-field textarea { background: #ffffff; }
html[data-theme="light"] .efl-g-result-box { background: rgba(20, 28, 56, .03); }
html[data-theme="light"] .efl-g-toast { background: #ffffff; }
html[data-theme="light"] .efl-g-port { background: #ffffff; }
