/* EzUI ノードボード(ezui-board.js) */
/* 盤面の切り替え: 表示中でない盤面のノード・グループ・カテゴリを隠す */
body[data-board="ezui"] #canvas .node:not([data-board="ezui"]), body[data-board="ezui"] #canvas .group-rect { display: none !important; }
body:not([data-board="ezui"]) #canvas .node[data-board="ezui"] { display: none !important; }
body[data-board="ezui"] #toolbar .node-cat-wrap:not(.ezui-cat) { display: none !important; }
body:not([data-board="ezui"]) #toolbar .ezui-cat { display: none !important; }
body[data-board="ezui"] #toolbar #group-mode-btn, body[data-board="ezui"] #toolbar #dock-toolbar-btn { display: none !important; }

.gs-board-switch { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; padding-right: 12px; border-right: 1px solid var(--border); }
.gs-board-tabs { display: inline-flex; gap: 2px; padding: 2px; background: var(--ui-input); border: 1px solid var(--border); border-radius: 6px; }
#toolbar .gs-board-switch .btn { min-height: 30px; padding: 4px 10px; white-space: nowrap; }
#toolbar .gs-board-tabs .btn { color: var(--text-muted); }
#toolbar .gs-board-switch .btn.active { background: var(--ui-selected); border-color: var(--ui-focus); color: var(--text); box-shadow: inset 0 -2px var(--ui-focus); font-weight: 600; }
#toolbar .gs-board-switch .btn[data-board="story"] { --ui-icon: url('logos/lucide/workflow.svg'); }
#toolbar .gs-board-switch .btn[data-board="ezui"] { --ui-icon: url('logos/lucide/panels-top-left.svg'); }
#toolbar .gs-board-switch .btn[data-win] { --ui-icon: url('logos/lucide/external-link.svg'); }
#toolbar .gs-board-switch .btn[data-res] { --ui-icon: url('logos/lucide/layers.svg'); }   /* v0.36.0 常駐 UI の割り当て */
#toolbar .gs-board-switch .btn::before { content: ''; }
#toolbar .btn-cat-ezui-screen { --ui-icon: url('logos/lucide/panels-top-left.svg'); }
#toolbar .btn-cat-ezui-elem { --ui-icon: url('logos/lucide/layers.svg'); }
#toolbar .btn-cat-ezui-value { --ui-icon: url('logos/lucide/settings-2.svg'); }
#toolbar .btn-cat-ezui-act { --ui-icon: url('logos/lucide/mouse-pointer-click.svg'); }
#toolbar .btn-cat-ezui-gssp { --ui-icon: url('logos/lucide/file-output.svg'); }
#toolbar .ezui-cat .btn { white-space: nowrap; }
#toolbar .ezui-cat .btn-cat::before { display: inline-block; }
#toolbar .ezui-cat .cat-dropdown .btn::before { content: ''; }
@media (max-width: 700px) { .gs-board-switch { padding-right: 0; border-right: 0; } }

/* ノード */
.node.ezb-node { width: 230px; min-height: 80px; }
.node.ezb-node .node-header { font-size: 13px; }
.node.ezb-screen .node-header { background: #2b3a55; }
.node.ezb-orphan .node-header::after { content: ' (未配置)'; font-size: 11px; opacity: .7; }
.node.ezb-node .ezb-body { padding: 4px 8px 6px; display: flex; flex-direction: column; gap: 3px; position: relative; }
.node.ezb-node .ezb-f { display: flex; align-items: center; gap: 4px; font-size: 11px; min-width: 0; }
.node.ezb-node .ezb-f > span { flex: 0 0 auto; width: 44px; opacity: .85; white-space: nowrap; overflow: hidden; }
.node.ezb-node .ezb-f input, .node.ezb-node .ezb-f select { flex: 1 1 auto; min-width: 0; font-size: 11px; padding: 1px 3px; border: 1px solid #666; background: #1b1b1f; color: #eee; }
.node.ezb-node .ezb-row { display: flex; gap: 4px; }
.node.ezb-node .ezb-row .ezb-f { flex: 1 1 0; }
.node.ezb-node .ezb-row .ezb-f > span { width: 28px; }
.node.ezb-node .ezb-img img { max-width: 100px; max-height: 40px; border: 1px solid #666; vertical-align: middle; }
.node.ezb-node .btn.ezb-pick, .node.ezb-node .btn.ezb-clear { font-size: 11px; padding: 1px 6px; }
.node.ezb-node .ezb-main:empty { display: none; }
/* 端子: 左に IN(要素 / ページ / 値)、右に OUT(置く / 押した)。top はノードの上からの位置 */
.node.ezb-node .connector.ezb-port { position: absolute; }
.node.ezb-node .connector.ezb-port-in { left: -7px; }
.node.ezb-node .connector.ezb-port-out { right: -7px; }
.node.ezb-node .ezb-ports-label { position: absolute; top: -1px; font-size: 9px; line-height: 24px; opacity: .55; pointer-events: none; }
.node.ezb-node .ezb-ports-label.ezb-ports-in { left: 2px; }
.node.ezb-node .ezb-ports-label.ezb-ports-out { right: 2px; text-align: right; }
.node.ezb-node .ezb-body { padding-top: 54px; }
.node.ezb-screen .ezb-body { padding-top: 54px; }   /* 端子 2 段(ページ / 前の画面) */
.node.ezb-node.ezb-gelem .ezb-body.ezb-body-s { padding-top: 54px; }   /* 出力 2 段(置く / 押した) */

/* 編集パネル */
.ezb-editor .ezb-pv-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; margin-bottom: 4px; gap: 8px; }
.ezb-editor .ezb-pv-hint { font-size: 11px; opacity: .7; }
.ezb-editor .ezb-pv { position: relative; width: 100%; border: 1px solid #666; background: #000; overflow: hidden; }
.ezb-editor .ezb-pv .ezui-canvas-root { margin: 0; }
.ezb-editor .ezb-pv .ezb-pv-el { cursor: move; }
.ezb-editor .ezb-pv .ezb-pv-el:hover { outline: 1px dashed rgba(255, 255, 255, .6); outline-offset: -1px; }
.ezb-editor .ezb-pv .ezb-pv-focus { outline: 2px solid #ffd54a !important; outline-offset: -2px; }
.ezb-editor .ezb-pv-none { font-size: 12px; padding: 6px; border: 1px solid #666; margin-bottom: 6px; }
.ezb-editor .ezb-src-hint { font-size: 11px; opacity: .7; margin: 6px 0 2px; }
.ezb-editor .ezb-mirror .ezb-body { display: flex; flex-direction: column; gap: 3px; }
.ezb-editor .ezb-mirror .ezb-f { display: flex; align-items: center; gap: 4px; font-size: 12px; }
.ezb-editor .ezb-mirror .ezb-f > span { flex: 0 0 auto; width: 64px; }
.ezb-editor .ezb-mirror .ezb-f input, .ezb-editor .ezb-mirror .ezb-f select { flex: 1 1 auto; min-width: 0; font-size: 12px; padding: 2px 4px; border: 1px solid #666; background: #1b1b1f; color: #eee; }
.ezb-editor .ezb-mirror .ezb-row { display: flex; gap: 6px; }
.ezb-editor .ezb-mirror .ezb-row .ezb-f { flex: 1 1 0; }
.ezb-editor .ezb-mirror .connector { display: none; }
/* 段 2: 値 / 操作 / 画面を出す */
.node.ezb-value, .node.ezb-act { width: 200px; }
.node.ezb-node .ezb-body.ezb-body-s { padding-top: 30px; }
.node.ezb-call { width: 230px; }
.node.ezb-call .ezb-body { padding: 4px 8px 6px; }
.node.ezb-call .ezb-f { display: flex; align-items: center; gap: 4px; font-size: 11px; }
.node.ezb-call .ezb-f > span { width: 36px; }
.node.ezb-call .ezb-f select { flex: 1 1 auto; min-width: 0; font-size: 11px; }
.node.ezb-call .ezb-call-row { position: relative; display: flex; justify-content: flex-end; align-items: center; height: 22px; font-size: 11px; padding-right: 6px; }
.node.ezb-call .ezb-call-row .connector { position: absolute; right: -15px; top: 4px; }
.node.ezb-call .ezb-call-cancel { opacity: .75; }
.node.ezb-call .ezb-call-stale .ezb-call-label::after { content: ' (出力に無い)'; opacity: .6; }
/* 段 3: GraphSplash ファイル / 要素 */
.node.ezb-file { width: 230px; }
.node.ezb-file .ezb-file-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node.ezb-file .ezb-file-meta { font-size: 10px; opacity: .7; }
.node.ezb-file .btn.ezb-open, .node.ezb-file .btn.ezb-reload { font-size: 11px; padding: 1px 6px; }
.node.ezb-file .ezb-file-pages { margin-top: 4px; }
.node.ezb-file .ezb-page-row { position: relative; display: flex; justify-content: flex-end; align-items: center; height: 22px; font-size: 11px; padding-right: 6px; }
.node.ezb-file .ezb-page-row .connector { position: absolute; right: -15px; top: 4px; }
.node.ezb-file .ezb-page-row.ezb-call-stale .ezb-page-label::after { content: ' (無いページ)'; opacity: .6; }
.node.ezb-gelem { width: 230px; }
.node.ezb-gelem .ezb-gelem-src { font-size: 11px; opacity: .75; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 別ウィンドウ(?ezui=win): EzUI の盤面だけ */
body.gs-ezui-window .gs-board-switch, body.gs-ezui-window #ezui-add-btn, body.gs-ezui-window #group-mode-btn, body.gs-ezui-window #dock-toolbar-btn { display: none !important; }
body.gs-ezui-window #title-bar::after { content: ' EzUI(別ウィンドウ)'; font-size: 12px; opacity: .8; }

#toolbar .gs-board-switch button:disabled { opacity: .5; cursor: default; background: transparent; border-color: transparent; box-shadow: none; }

/* タイトルノードの「画面と遷移は EzUI で決める」(app.js setTitleUi) */
.node.node-title .title-ezui-toggle { display: flex; align-items: center; gap: 4px; font-size: 11px; padding: 4px 8px 2px; cursor: pointer; }
.node.node-title .title-ezui-row { display: none; position: relative; justify-content: flex-end; align-items: center; height: 24px; font-size: 11px; padding: 0 24px 0 8px; opacity: .85; }
.node.node-title.title-ezui .title-ezui-row { display: flex; }
.node.node-title.title-ezui .title-item { opacity: .4; }
.node.node-title .title-ezui-row .title-ezui-out { position: absolute; right: -20px; top: 50%; margin-top: -6px; background: #f9d423 !important; }
.node.ezb-call .ezb-chk { display: flex; align-items: center; gap: 4px; font-size: 11px; margin: 2px 0; cursor: pointer; }
.node.node-title.title-ezui .title-item-out { pointer-events: none; }   /* EzUI で決める時は項目の出力から線を引かない(app.js startConnecting でも止める) */

/* 入れる物の行(画面 / 枠)。行ごとの右の出力 → 要素ノードの左の「入れ物から」。旧い向きの端子(要素 / 置く)は隠す */
.node.ezb-node .connector.ezb-legacy { display: none; }
.node.ezb-node .ezb-rows-sec { margin-top: 4px; border-top: 1px solid rgba(255,255,255,.12); padding-top: 4px; }
.node.ezb-node .ezb-rows-head { font-size: 10px; opacity: .65; margin-bottom: 2px; }
.node.ezb-node .ezb-put-row { position: relative; display: flex; align-items: center; gap: 4px; height: 26px; font-size: 11px; padding-right: 4px; }
.node.ezb-node .ezb-put-row .sort-handle { cursor: grab; opacity: .5; flex-shrink: 0; }
#canvas .node.ezb-node .ezb-put-row select.ezb-row-slot { flex: 0 0 auto; max-width: 110px; height: 22px; padding: 0 4px !important; font-size: 11px !important; box-sizing: border-box; }
.node.ezb-node .ezb-put-row .ezb-row-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .8; }
.node.ezb-node .ezb-put-row .ezb-row-del { background: transparent; border: none; color: inherit; opacity: .6; cursor: pointer; padding: 0 2px; }
.node.ezb-node .ezb-put-row .ezb-row-del:hover { opacity: 1; }
.node.ezb-node .ezb-put-row .connector.ezb-put-out { position: absolute; right: -15px; top: 7px; }
.node.ezb-node .ezb-row-add { margin-top: 2px; font-size: 11px; padding: 1px 6px; }
/* 数の欄の上下の矢印は出さない(数字が矢印に隠れる)。値は直接打つ / ホイールで */
#canvas .node.ezb-node input[type="number"]::-webkit-inner-spin-button,
#canvas .node.ezb-node input[type="number"]::-webkit-outer-spin-button,
.ezb-editor input[type="number"]::-webkit-inner-spin-button,
.ezb-editor input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
#canvas .node.ezb-node input[type="number"], .ezb-editor input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
/* 画面ノードの遷移(入り / 出): 種類を広く・時間は狭く */
.node.ezb-screen .ezb-trans .ezb-f:first-child { flex: 1 1 auto; min-width: 0; }
.node.ezb-screen .ezb-trans .ezb-f:first-child select { flex: 1 1 auto; min-width: 0; width: 100%; }
.node.ezb-screen .ezb-trans .ezb-f:last-child { flex: 0 0 auto; }
.node.ezb-screen .ezb-trans .ezb-f:last-child input { width: 56px; }
.node.ezb-screen .ezb-trans .ezb-f:last-child > span { display: none; }   /* 「ms」は欄の中の目安で */
.node.ezb-screen .ezb-trans .ezb-f:last-child input { width: 52px; }

/* 読み込み中は盤面(ノードと線)を隠し、そろってから一度に見せる(ezui-board.js の loadFromData) */
body.gs-board-loading #viewport > * { visibility: hidden !important; }
body.gs-board-loading #viewport::after { content: "読み込み中..."; position: absolute; left: 50%; top: 45%; transform: translateX(-50%); font-size: 12px; color: #8b919b; pointer-events: none; }
