/* ============================================================
   PyCharm Darcula 风格主题（在 v2 之后加载，覆盖配色）
   ============================================================ */
:root {
  --bg: #1e1f22;
  --bg-2: #2b2b2b;
  --panel: #2b2b2b;
  --panel-2: #313335;
  --panel-3: #3c3f41;
  --line: #323232;
  --line-soft: #2f3033;
  --text: #a9b7c6;
  --muted: #8a939e;
  --muted-2: #6f7781;
  --accent: #4a88c7;
  --accent-soft: rgba(74, 136, 199, 0.18);
  --orange: #cc7832;
  --green: #6a8759;
  --purple: #9876aa;
  --danger: #d15b5b;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

html, body {
  background: #1e1f22;
  color: #a9b7c6;
  font-family: "微软雅黑", "Segoe UI", system-ui, sans-serif;
}

/* ---- 顶栏：PyCharm 主工具栏 ---- */
.topbar {
  background: #3c3f41;
  border: 1px solid #323232;
  border-radius: 0;
  box-shadow: 0 1px 0 #323232;
  padding: 8px 14px;
}
.brand-logo {
  background: linear-gradient(135deg, #4a88c7 0%, #2a6da8 100%);
  color: #ffffff;
  border-radius: 7px;
  box-shadow: none;
  width: 34px; height: 34px;
  font-size: 18px;
}
.brand-name { color: #e8edf3; font-size: 14px; }
.brand-sub { color: #7f8c98; font-size: 10.5px; }
.topbar .field-label { color: #8a939e; }
.topbar .input,
.input {
  background: #2b2b2b;
  border: 1px solid #4a4d4f;
  color: #a9b7c6;
  border-radius: 4px;
}
.input:focus, .topbar .input:focus {
  border-color: #4a88c7;
  box-shadow: 0 0 0 2px rgba(74, 136, 199, 0.22);
}
.topbar .btn,
.btn {
  background: #4c5052;
  border: 1px solid #4c5052;
  color: #d6dbe0;
  border-radius: 4px;
  height: 32px;
  font-size: 12px;
}
.topbar .btn:hover, .btn:hover {
  background: #5a5f61;
  border-color: #5a5f61;
}
.btn.primary {
  background: #4e9a51;
  border-color: #4e9a51;
  color: #ffffff;
  box-shadow: none;
  animation: none;
}
.btn.primary:hover { background: #57a95b; border-color: #57a95b; }
.btn.danger-ghost {
  background: transparent;
  border-color: #7c4a4a;
  color: #d98c8c;
}
.btn::after { display: none; }

/* ---- 主体三栏 ---- */
.main { gap: 1px; background: #323232; }
.palette, .inspector {
  background: #2b2b2b;
  border: 1px solid #323232;
  border-radius: 0;
  box-shadow: none;
}
.palette-head, .inspector-head {
  background: #3c3f41;
  color: #bbbbbb;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  border-bottom: 1px solid #323232;
  padding: 8px 12px;
}
.palette-search {
  background: #2b2b2b;
  border: 1px solid #4a4d4f;
  border-radius: 4px;
  color: #a9b7c6;
}
.palette-search:focus { border-color: #4a88c7; box-shadow: none; }
.palette-list { padding: 8px; }
.palette-group { margin-bottom: 10px; }
.palette-group-title {
  color: #8a939e;
  font-size: 10.5px;
  letter-spacing: 0.5px;
  margin: 4px 4px 6px;
  display: flex;
  align-items: center;
}
.palette-group-title::before {
  content: "▸";
  width: auto; height: auto;
  background: none;
  color: #7f8c98;
  font-size: 10px;
  border-radius: 0;
  margin-right: 2px;
}
.palette-grid { gap: 6px; }
.tile {
  background: #313335;
  border: 1px solid #323232;
  border-radius: 5px;
  padding: 7px 9px;
}
.tile:hover { background: #3c3f41; border-color: #4a4d4f; }
.tile-name { color: #d6dbe0; font-size: 11.5px; }
.tile:hover .tile-name { color: #ffffff; }
.tile-short { color: #6f7781; font-size: 9.5px; }
.tile::before { display: none; }
.tile-link { border-color: #4a4d4f; background: #313335; }
.tile-link .tile-short { color: #7fb98a; }
.tile-link.skip .tile-short { color: #cc7832; }
.palette-tip {
  background: #2b2b2b;
  border-top: 1px solid #323232;
  color: #7f8c98;
  font-size: 10px;
  line-height: 1.65;
}

/* ---- 编辑器标签栏（PyCharm 选项卡） ---- */
.editor-tabs {
  display: flex;
  align-items: stretch;
  height: 34px;
  background: #3c3f41;
  border: 1px solid #323232;
  border-bottom: none;
  flex-shrink: 0;
  overflow: hidden;
}
.editor-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  font-size: 11.5px;
  color: #8a939e;
  border-right: 1px solid #323232;
  cursor: default;
  position: relative;
}
.editor-tab.active {
  background: #2b2b2b;
  color: #d6dbe0;
}
.editor-tab.active::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 2px;
  background: #4a88c7;
}
.editor-tab .file-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #6a8759;
}
.editor-tab.python .file-dot { background: #cc7832; }
.editor-tabs .spacer { flex: 1; }
.editor-tabs .tab-hint {
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 10.5px;
  color: #6f7781;
  white-space: nowrap;
}

/* ---- 画布：深色编辑器底 + 网格 ---- */
.workspace { gap: 0; }
.canvas {
  background-color: #2b2b2b;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: 0 0;
  border: 1px solid #323232;
  border-radius: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.canvas::after {
  background: radial-gradient(320px 320px at var(--mx, 50%) var(--my, 50%), rgba(74, 136, 199, 0.07), transparent 70%);
}
.canvas-title { color: #5f6772; }
.canvas.selecting { cursor: crosshair; }

/* ---- 节点：编辑器里的代码块风格 ---- */
.node {
  background: linear-gradient(180deg, #3c3f41 0%, #36393b 100%);
  border: 1px solid #4a4d4f;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.node::before {
  width: 3px;
  border-radius: 3px 0 0 3px;
  background: var(--node-color, #5f6772);
  opacity: 1;
  box-shadow: none;
}
.node:hover {
  border-color: #4a88c7;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
.node.selected {
  border-color: #4a88c7;
  box-shadow: 0 0 0 2px rgba(74, 136, 199, 0.45), 0 4px 14px rgba(0, 0, 0, 0.45);
  animation: none;
}
.node-title {
  color: #d6dbe0;
  font-family: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  font-size: 12px;
}
.node-type {
  color: #6f7781;
  font-size: 9px;
  font-family: "JetBrains Mono", Consolas, monospace;
}
.node-summary { color: #a9b7c6; font-size: 10px; }
.node-shape {
  background: #2b2b2b;
  border: 1px solid #4a4d4f;
  color: #cc7832;
  border-radius: 4px;
  font-family: "JetBrains Mono", Consolas, monospace;
}
.node.has-error { border-color: #d15b5b; }
.node-error-dot { background: #d15b5b; }
.node.link-target {
  border-color: #4a88c7 !important;
  box-shadow: 0 0 0 2px rgba(74, 136, 199, 0.4) !important;
}

/* ---- 块节点：深色语法高亮色块 ---- */
.node.block {
  border-width: 1px;
  border-radius: 6px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.node.block::after {
  border: 1px solid rgba(255, 255, 255, 0.10);
  inset: 2px;
}
.node.block .block-name {
  color: #e8edf3;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  text-shadow: none;
}
.node.block .block-meta { color: #b8c6d4; opacity: 0.85; font-size: 9px; }
.node.block.circle::after { inset: 3px; }
.node.block:hover { box-shadow: 0 5px 18px rgba(0, 0, 0, 0.55); }

/* ---- 端口 ---- */
.port {
  background: #2b2b2b;
  border: 2px solid #7f8c98;
}
.node:hover .port { opacity: 0.95; }
.port:hover {
  border-color: #4a88c7;
  box-shadow: 0 0 0 3px rgba(74, 136, 199, 0.25);
}

/* ---- 连线：浅灰代码线 / 橙色关键字跳跃线 ---- */
.edge-path { stroke: #7f8c98; stroke-width: 1.8; }
.edge-path.edge-skip { stroke: #cc7832; stroke-width: 2.3; }
.edge-path.edge-selected { stroke: #4a88c7 !important; stroke-width: 2.6; }
.edge-plus { fill: #e8a45c; }
.edge-g:hover .edge-path:not(.edge-skip) { stroke: #a9b7c6; stroke-width: 2.3; }
.edge-g:hover .edge-path.edge-skip { stroke: #e8a45c; stroke-width: 2.8; }
.edge-temp { stroke: #4a88c7; }
#arrow path { fill: #7f8c98; }
#arrow-skip path { fill: #cc7832; }
.marquee {
  border: 1px solid #4a88c7;
  background: rgba(74, 136, 199, 0.12);
  border-radius: 2px;
  box-shadow: none;
}

/* ---- 属性面板 / 状态栏 ---- */
.inspector-body { padding: 10px 12px; }
.insp-title { color: #e8edf3; font-size: 13px; }
.insp-sub, .insp-section-title { color: #7f8c98; }
.insp-section-title { font-size: 10px; letter-spacing: 0.6px; }
.insp-shape {
  background: #2b2b2b;
  border: 1px solid #4a4d4f;
  color: #cc7832;
}
.field-row label { color: #a9b7c6; font-size: 11.5px; }
.field-row input[type="number"], .field-row input[type="text"], .field-row select {
  background: #2b2b2b;
  border: 1px solid #4a4d4f;
  color: #a9b7c6;
  border-radius: 3px;
  height: 26px;
}
.field-row input:focus, .field-row select:focus { border-color: #4a88c7; }
.field-row:hover { background: #323232; }
.switch { background: #2b2b2b; border-color: #4a4d4f; }
.switch::after { background: #7f8c98; }
.switch.on { background: #365a3a; border-color: #4e9a51; }
.switch.on::after { background: #6aab6f; }
.insp-error {
  background: rgba(209, 91, 91, 0.12);
  border-color: #7c4a4a;
  color: #dd9a9a;
}
.insp-empty, .inspector-empty { color: #6f7781; }

.statusbar {
  height: 30px;
  background: #3c3f41;
  border: 1px solid #323232;
  border-top: none;
  padding: 0 10px;
  color: #8a939e;
  font-size: 10.5px;
}
.status-left { gap: 12px; }
.chip {
  background: transparent;
  border: none;
  padding: 0;
  height: 20px;
  color: #8a939e;
  font-size: 10.5px;
  gap: 5px;
}
.chip .dot {
  width: 6px; height: 6px;
  background: #6a8759;
  box-shadow: none;
  border-radius: 50%;
}
.status-right { gap: 6px; }
#zoomText { color: #8a939e; font-size: 10.5px; min-width: 36px; text-align: center; }
.icon-btn {
  background: #4c5052;
  border: 1px solid #4c5052;
  color: #d6dbe0;
  border-radius: 3px;
  width: 24px; height: 22px;
  font-size: 12px;
}
.icon-btn:hover { background: #5a5f61; }
.icon-btn.wide { font-size: 10.5px; padding: 0 8px; }

/* ---- 弹窗 / 代码视图 ---- */
.modal-mask { background: rgba(0, 0, 0, 0.55); backdrop-filter: none; }
.modal {
  background: #3c3f41;
  border: 1px solid #4a4d4f;
  border-radius: 4px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}
.modal-head {
  background: #2b2b2b;
  color: #d6dbe0;
  font-size: 12.5px;
  padding: 10px 14px;
  border-bottom: 1px solid #323232;
}
.modal-foot {
  background: #2b2b2b;
  border-top: 1px solid #323232;
  padding: 10px 14px;
}
.modal-body { padding: 14px; }
.modal-field > label { color: #8a939e; font-size: 11px; }
.modal-grid .modal-field { margin-bottom: 0; }
.code-view {
  background: #2b2b2b;
  border: 1px solid #323232;
  border-radius: 2px;
  color: #a9b7c6;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 11.5px;
}
.shape-option {
  background: #2b2b2b;
  border: 1px solid #4a4d4f;
  border-radius: 4px;
  color: #a9b7c6;
}
.shape-option.active { background: #365a3a; border-color: #4e9a51; color: #d6f0d8; }
.shape-option .shape-preview { border-color: #7f8c98; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #4c5052; border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: #5a5f61; }

/* ---- PyCharm 菜单栏 / 状态栏细节 ---- */
.ide-menubar {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 24px;
  padding: 0 8px;
  background: #3c3f41;
  border: 1px solid #323232;
  border-bottom: none;
  flex-shrink: 0;
  font-size: 11px;
  color: #a9b7c6;
}
.ide-menubar .menu-item {
  padding: 2px 7px;
  border-radius: 3px;
  cursor: default;
  color: #bbb;
}
.ide-menubar .menu-item:hover { background: #4c5052; color: #fff; }
.menubar-spacer { flex: 1; }
.menubar-title { color: #6f7781; font-size: 10.5px; padding-right: 6px; }
.ide-status-item {
  margin-left: 8px;
  color: #7f8c98;
  font-size: 10px;
  white-space: nowrap;
}
#app { gap: 0; }
