/*
 * Amethyst Mapper primary UI stylesheet.
 * Responsibilities in this file:
 * 1. Define visual system tokens, layout, and interactive component styling.
 * 2. Style canvas primitives (cards/groups/links), tools, and dialogs.
 * 3. Maintain responsive and touch-friendly behavior across viewport classes..
 */

:root {
  --bg: #140f24;
  --grid: rgba(214, 191, 255, 0.1);
  --grid2: rgba(173, 145, 238, 0.06);
  --stage-radial-a: rgba(181, 132, 255, 0.18);
  --stage-radial-b: rgba(139, 108, 232, 0.16);
  --stage-fade-top: rgba(27, 20, 47, 0.22);
  --stage-fade-bottom: rgba(10, 8, 19, 0.38);
  --node-bg-a: rgba(55, 43, 86, 0.99);
  --node-bg-b: rgba(33, 27, 56, 0.995);
  --node-border: rgba(220, 204, 255, 0.3);
  --node-text: rgba(251, 246, 255, 0.95);
  --node-muted: rgba(247, 236, 255, 0.62);
  --node-header-bg: rgba(216, 193, 255, 0.09);
  --node-header-border: rgba(222, 206, 255, 0.18);
  --group-bg: rgba(70, 55, 108, 0.24);
  --group-border: rgba(214, 196, 255, 0.44);
  --txt: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.65);
  --link-color: #9ed8ff;
  --link-hover: #d4efff;
  --link-visited: #c7b7ff;
  --accent: #a472ff;
  --accent-soft: #d4b7ff;
  --ui-topbar-bg:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  --ui-surface: rgba(10, 14, 26, 0.62);
  --ui-surface-strong: rgba(10, 14, 26, 0.92);
  --ui-surface-soft: rgba(255, 255, 255, 0.04);
  --ui-surface-soft-hover: rgba(255, 255, 255, 0.07);
  --ui-surface-soft-active: rgba(92, 51, 168, 0.18);
  --ui-menu-bg: rgba(10, 14, 26, 0.94);
  --ui-dialog-bg: rgba(10, 14, 26, 0.92);
  --ui-input-bg: rgba(10, 14, 26, 0.75);
  --ui-input-bg-strong: rgba(14, 18, 32, 0.94);
  --ui-border: rgba(255, 255, 255, 0.12);
  --ui-border-strong: rgba(255, 255, 255, 0.16);
  --ui-accent-bg: rgba(92, 51, 168, 0.45);
  --ui-accent-bg-soft: rgba(154, 111, 255, 0.22);
  --ui-accent-border: rgba(199, 161, 255, 0.68);
  --ui-accent-border-soft: rgba(154, 111, 255, 0.5);
  --ui-button-bg: rgba(6, 40, 45, 0.55);
  --ui-button-bg-hover: rgba(6, 55, 60, 0.62);
  --ui-button-border: rgba(20, 184, 166, 0.28);
  --ui-button-border-hover: rgba(34, 211, 238, 0.55);
  --ui-danger-bg: rgba(60, 18, 24, 0.55);
  --ui-danger-bg-hover: rgba(80, 24, 30, 0.62);
  --ui-danger-border: rgba(255, 99, 99, 0.25);
  --ui-danger-border-hover: rgba(255, 120, 120, 0.55);
  --ui-scrollbar-track: rgba(19, 15, 36, 0.92);
  --ui-scrollbar-thumb:
    linear-gradient(180deg, rgba(212, 183, 255, 0.88), rgba(122, 97, 184, 0.92));
  --ui-scrollbar-thumb-hover:
    linear-gradient(180deg, rgba(232, 212, 255, 0.94), rgba(164, 114, 255, 0.96));
  --node-link-color: #d9f4ff;
  --node-link-hover: #ffffff;
  --stroke: rgba(188, 153, 255, 0.84);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --dd-glow:
    0 0 18px rgba(204, 153, 255, 0.3), 0 0 36px rgba(140, 92, 226, 0.24);
  --radius: 14px;
  --font:
    ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  scrollbar-color: var(--ui-accent-border) var(--ui-scrollbar-track);
  scrollbar-width: thin;
}
.app.theme-amethyst,
:root.theme-amethyst {
  --grid: rgba(214, 191, 255, 0.1);
  --grid2: rgba(173, 145, 238, 0.06);
  --stage-radial-a: rgba(181, 132, 255, 0.18);
  --stage-radial-b: rgba(139, 108, 232, 0.16);
  --stage-fade-top: rgba(27, 20, 47, 0.22);
  --stage-fade-bottom: rgba(10, 8, 19, 0.38);
}
.app.theme-blue,
:root.theme-blue {
  --bg: #0b1524;
  --grid: rgba(126, 174, 228, 0.16);
  --grid2: rgba(87, 136, 196, 0.1);
  --stage-radial-a: rgba(76, 150, 255, 0.18);
  --stage-radial-b: rgba(52, 109, 189, 0.16);
  --stage-fade-top: rgba(13, 28, 48, 0.22);
  --stage-fade-bottom: rgba(7, 14, 25, 0.38);
  --txt: rgba(239, 247, 255, 0.94);
  --muted: rgba(190, 210, 228, 0.7);
  --ui-topbar-bg:
    linear-gradient(to bottom, rgba(22, 48, 78, 0.82), rgba(10, 26, 44, 0.7));
  --ui-surface: rgba(11, 22, 37, 0.74);
  --ui-surface-strong: rgba(8, 18, 31, 0.94);
  --ui-surface-soft: rgba(67, 102, 145, 0.12);
  --ui-surface-soft-hover: rgba(84, 128, 181, 0.18);
  --ui-surface-soft-active: rgba(50, 92, 153, 0.26);
  --ui-menu-bg: rgba(8, 18, 31, 0.96);
  --ui-dialog-bg: rgba(9, 18, 33, 0.94);
  --ui-input-bg: rgba(10, 22, 38, 0.82);
  --ui-input-bg-strong: rgba(13, 26, 42, 0.96);
  --ui-border: rgba(150, 189, 230, 0.16);
  --ui-border-strong: rgba(150, 189, 230, 0.24);
  --ui-accent-bg: rgba(39, 89, 161, 0.42);
  --ui-accent-bg-soft: rgba(78, 137, 217, 0.18);
  --ui-accent-border: rgba(121, 183, 255, 0.7);
  --ui-accent-border-soft: rgba(121, 183, 255, 0.44);
  --ui-button-bg: rgba(13, 46, 78, 0.58);
  --ui-button-bg-hover: rgba(18, 60, 101, 0.7);
  --ui-button-border: rgba(79, 158, 255, 0.34);
  --ui-button-border-hover: rgba(128, 198, 255, 0.6);
  --ui-scrollbar-track: rgba(9, 18, 31, 0.96);
  --ui-scrollbar-thumb:
    linear-gradient(180deg, rgba(158, 211, 255, 0.88), rgba(72, 132, 210, 0.92));
  --ui-scrollbar-thumb-hover:
    linear-gradient(180deg, rgba(214, 239, 255, 0.94), rgba(105, 170, 245, 0.96));
}
.app.theme-slate,
:root.theme-slate {
  --bg: #17191f;
  --grid: rgba(144, 150, 162, 0.12);
  --grid2: rgba(103, 109, 121, 0.08);
  --stage-radial-a: rgba(123, 130, 143, 0.16);
  --stage-radial-b: rgba(88, 95, 107, 0.14);
  --stage-fade-top: rgba(28, 31, 38, 0.28);
  --stage-fade-bottom: rgba(18, 20, 26, 0.44);
  --txt: rgba(242, 244, 248, 0.92);
  --muted: rgba(197, 201, 210, 0.64);
  --ui-topbar-bg:
    linear-gradient(to bottom, rgba(52, 57, 66, 0.62), rgba(22, 25, 31, 0.52));
  --ui-surface: rgba(22, 25, 31, 0.72);
  --ui-surface-strong: rgba(19, 21, 27, 0.94);
  --ui-surface-soft: rgba(255, 255, 255, 0.038);
  --ui-surface-soft-hover: rgba(255, 255, 255, 0.072);
  --ui-surface-soft-active: rgba(104, 112, 126, 0.2);
  --ui-menu-bg: rgba(19, 21, 27, 0.96);
  --ui-dialog-bg: rgba(20, 22, 29, 0.94);
  --ui-input-bg: rgba(27, 30, 38, 0.86);
  --ui-input-bg-strong: rgba(29, 32, 41, 0.96);
  --ui-border: rgba(255, 255, 255, 0.1);
  --ui-border-strong: rgba(255, 255, 255, 0.16);
  --ui-accent-bg: rgba(104, 112, 126, 0.28);
  --ui-accent-bg-soft: rgba(128, 136, 152, 0.16);
  --ui-accent-border: rgba(196, 206, 222, 0.54);
  --ui-accent-border-soft: rgba(196, 206, 222, 0.28);
  --ui-button-bg: rgba(37, 42, 52, 0.58);
  --ui-button-bg-hover: rgba(45, 52, 64, 0.74);
  --ui-button-border: rgba(180, 188, 204, 0.22);
  --ui-button-border-hover: rgba(220, 227, 239, 0.44);
  --ui-scrollbar-track: rgba(19, 21, 27, 0.96);
  --ui-scrollbar-thumb:
    linear-gradient(180deg, rgba(195, 201, 210, 0.78), rgba(101, 109, 123, 0.92));
  --ui-scrollbar-thumb-hover:
    linear-gradient(180deg, rgba(228, 231, 237, 0.9), rgba(128, 136, 152, 0.96));
}
.app.theme-light,
:root.theme-light {
  --bg: #cfd5df;
  --grid: rgba(118, 120, 143, 0.16);
  --grid2: rgba(148, 151, 176, 0.1);
  --stage-radial-a: rgba(196, 205, 221, 0.4);
  --stage-radial-b: rgba(172, 184, 205, 0.34);
  --stage-fade-top: rgba(224, 230, 240, 0.82);
  --stage-fade-bottom: rgba(196, 205, 220, 0.92);
  --txt: rgba(28, 34, 50, 0.94);
  --muted: rgba(71, 79, 102, 0.74);
  --node-text: rgba(16, 22, 36, 0.94);
  --node-muted: rgba(28, 36, 58, 0.66);
  --node-link-color: #163d72;
  --node-link-hover: #08162d;
  --ui-topbar-bg:
    linear-gradient(to bottom, rgba(246, 248, 252, 0.92), rgba(232, 236, 244, 0.86));
  --ui-surface: rgba(246, 248, 252, 0.82);
  --ui-surface-strong: rgba(250, 252, 255, 0.96);
  --ui-surface-soft: rgba(74, 88, 124, 0.08);
  --ui-surface-soft-hover: rgba(74, 88, 124, 0.12);
  --ui-surface-soft-active: rgba(104, 122, 166, 0.16);
  --ui-menu-bg: rgba(250, 252, 255, 0.98);
  --ui-dialog-bg: rgba(248, 250, 255, 0.98);
  --ui-input-bg: rgba(242, 244, 252, 0.96);
  --ui-input-bg-strong: rgba(244, 246, 252, 0.98);
  --ui-border: rgba(91, 102, 132, 0.18);
  --ui-border-strong: rgba(91, 102, 132, 0.24);
  --ui-accent-bg: rgba(118, 102, 190, 0.14);
  --ui-accent-bg-soft: rgba(118, 102, 190, 0.1);
  --ui-accent-border: rgba(118, 102, 190, 0.42);
  --ui-accent-border-soft: rgba(118, 102, 190, 0.24);
  --ui-button-bg: rgba(220, 231, 241, 0.92);
  --ui-button-bg-hover: rgba(205, 221, 236, 0.96);
  --ui-button-border: rgba(82, 100, 138, 0.28);
  --ui-button-border-hover: rgba(56, 83, 142, 0.48);
  --ui-danger-bg: rgba(255, 231, 234, 0.94);
  --ui-danger-bg-hover: rgba(255, 220, 224, 0.98);
  --ui-danger-border: rgba(196, 82, 107, 0.28);
  --ui-danger-border-hover: rgba(196, 82, 107, 0.42);
  --ui-scrollbar-track: rgba(219, 225, 237, 0.9);
  --ui-scrollbar-thumb:
    linear-gradient(180deg, rgba(170, 180, 210, 0.82), rgba(126, 138, 176, 0.92));
  --ui-scrollbar-thumb-hover:
    linear-gradient(180deg, rgba(152, 165, 206, 0.9), rgba(99, 115, 160, 0.96));
}
.app.theme-skin1,
:root.theme-skin1 {
  --bg: #091111;
  --grid: rgba(124, 220, 207, 0.13);
  --grid2: rgba(218, 194, 128, 0.075);
  --stage-radial-a: rgba(88, 214, 188, 0.16);
  --stage-radial-b: rgba(181, 136, 255, 0.12);
  --stage-fade-top: rgba(14, 24, 24, 0.42);
  --stage-fade-bottom: rgba(5, 8, 10, 0.58);
  --node-bg-a: rgba(25, 36, 39, 0.985);
  --node-bg-b: rgba(13, 19, 23, 0.995);
  --node-border: rgba(146, 226, 211, 0.28);
  --node-text: rgba(244, 252, 248, 0.96);
  --node-muted: rgba(var(--skin1-muted-rgb), 0.66);
  --node-header-bg: rgba(128, 222, 204, 0.075);
  --node-header-border: rgba(137, 224, 208, 0.16);
  --group-bg: rgba(41, 68, 66, 0.22);
  --group-border: rgba(144, 225, 209, 0.42);
  --txt: rgba(245, 252, 249, 0.95);
  --muted: rgba(204, 220, 217, 0.68);
  --link-color: #8ee7d6;
  --link-hover: #d8fff5;
  --link-visited: #dbc5ff;
  --accent: #6ee7c8;
  --accent-soft: #ffe0a3;
  --ui-topbar-bg:
    linear-gradient(180deg, rgba(18, 28, 29, 0.94), rgba(8, 14, 16, 0.86));
  --ui-surface: rgba(10, 17, 19, 0.74);
  --ui-surface-strong: rgba(8, 13, 15, 0.95);
  --ui-surface-soft: rgba(255, 255, 255, 0.055);
  --ui-surface-soft-hover: rgba(116, 219, 199, 0.095);
  --ui-surface-soft-active: rgba(110, 231, 200, 0.16);
  --ui-menu-bg: rgba(8, 13, 15, 0.975);
  --ui-dialog-bg: rgba(9, 14, 16, 0.965);
  --ui-input-bg: rgba(6, 11, 13, 0.82);
  --ui-input-bg-strong: rgba(8, 13, 15, 0.97);
  --ui-border: rgba(184, 218, 211, 0.13);
  --ui-border-strong: rgba(var(--skin1-panel-border-rgb), 0.22);
  --ui-accent-bg: rgba(55, 143, 128, 0.34);
  --ui-accent-bg-soft: rgba(110, 231, 200, 0.13);
  --ui-accent-border: rgba(var(--skin1-accent-rgb), 0.62);
  --ui-accent-border-soft: rgba(var(--skin1-accent-rgb), 0.34);
  --ui-button-bg: rgba(14, 27, 29, 0.72);
  --ui-button-bg-hover: rgba(22, 45, 47, 0.9);
  --ui-button-border: rgba(136, 226, 209, 0.28);
  --ui-button-border-hover: rgba(132, 245, 221, 0.62);
  --ui-danger-bg: rgba(64, 20, 27, 0.58);
  --ui-danger-bg-hover: rgba(86, 27, 35, 0.74);
  --ui-danger-border: rgba(255, 125, 145, 0.3);
  --ui-danger-border-hover: rgba(255, 146, 164, 0.64);
  --ui-scrollbar-track: rgba(7, 11, 13, 0.96);
  --ui-scrollbar-thumb:
    linear-gradient(180deg, rgba(127, 238, 213, 0.82), rgba(93, 136, 133, 0.92));
  --ui-scrollbar-thumb-hover:
    linear-gradient(180deg, rgba(200, 255, 243, 0.95), rgba(112, 218, 199, 0.96));
  --node-link-color: #aaf5e7;
  --node-link-hover: #ffffff;
  --stroke: rgba(126, 232, 212, 0.82);
  --shadow: 0 18px 54px rgba(0, 0, 0, 0.5);
  --dd-glow:
    0 0 0 1px rgba(142, 247, 222, 0.18), 0 12px 30px rgba(0, 0, 0, 0.32),
    0 0 28px rgba(82, 221, 194, 0.16);
  --radius: 12px;
  --skin1-focus-ring: rgba(var(--skin1-accent-rgb), 0.78);
  --skin1-amber: rgba(var(--skin1-warm-rgb), 0.86);
  --skin1-motion: cubic-bezier(0.2, 0.8, 0.2, 1);
  --skin1-accent-rgb: 125, 238, 213;
  --skin1-soft-accent-rgb: 92, 231, 202;
  --skin1-warm-rgb: 255, 211, 142;
  --skin1-panel-border-rgb: 191, 232, 223;
  --skin1-muted-rgb: 210, 230, 224;
  --plus-bg-a: #071010;
  --plus-bg-b: #0e1b1d;
  --plus-bg-c: #20302f;
  color-scheme: dark;
}
.app.theme-skin2,
:root.theme-skin2 {
  --bg: #07111f;
  --grid: rgba(124, 176, 255, 0.14);
  --grid2: rgba(133, 229, 255, 0.065);
  --stage-radial-a: rgba(83, 151, 255, 0.17);
  --stage-radial-b: rgba(112, 238, 255, 0.1);
  --stage-fade-top: rgba(11, 24, 43, 0.46);
  --stage-fade-bottom: rgba(4, 8, 15, 0.62);
  --node-bg-a: rgba(21, 34, 54, 0.985);
  --node-bg-b: rgba(9, 17, 31, 0.995);
  --node-border: rgba(141, 187, 255, 0.29);
  --node-text: rgba(244, 249, 255, 0.96);
  --node-muted: rgba(204, 220, 239, 0.66);
  --node-header-bg: rgba(125, 183, 255, 0.075);
  --node-header-border: rgba(144, 194, 255, 0.16);
  --group-bg: rgba(36, 58, 91, 0.22);
  --group-border: rgba(145, 190, 255, 0.42);
  --txt: rgba(245, 249, 255, 0.95);
  --muted: rgba(203, 216, 235, 0.69);
  --link-color: #99ceff;
  --link-hover: #e0f3ff;
  --link-visited: #cfc5ff;
  --accent: #7db7ff;
  --accent-soft: #a6f3ff;
  --ui-topbar-bg:
    linear-gradient(180deg, rgba(13, 27, 48, 0.95), rgba(6, 13, 25, 0.88));
  --ui-surface: rgba(8, 16, 30, 0.76);
  --ui-surface-strong: rgba(6, 12, 23, 0.955);
  --ui-surface-soft: rgba(255, 255, 255, 0.052);
  --ui-surface-soft-hover: rgba(125, 183, 255, 0.1);
  --ui-surface-soft-active: rgba(125, 183, 255, 0.17);
  --ui-menu-bg: rgba(6, 12, 23, 0.978);
  --ui-dialog-bg: rgba(7, 13, 25, 0.968);
  --ui-input-bg: rgba(5, 10, 19, 0.84);
  --ui-input-bg-strong: rgba(7, 13, 25, 0.972);
  --ui-border: rgba(181, 210, 250, 0.13);
  --ui-border-strong: rgba(190, 221, 255, 0.22);
  --ui-accent-bg: rgba(58, 112, 183, 0.36);
  --ui-accent-bg-soft: rgba(125, 183, 255, 0.14);
  --ui-accent-border: rgba(137, 194, 255, 0.64);
  --ui-accent-border-soft: rgba(137, 194, 255, 0.36);
  --ui-button-bg: rgba(12, 25, 44, 0.74);
  --ui-button-bg-hover: rgba(19, 39, 68, 0.92);
  --ui-button-border: rgba(139, 190, 255, 0.29);
  --ui-button-border-hover: rgba(156, 214, 255, 0.64);
  --ui-danger-bg: rgba(60, 20, 32, 0.58);
  --ui-danger-bg-hover: rgba(82, 27, 42, 0.74);
  --ui-danger-border: rgba(255, 126, 158, 0.3);
  --ui-danger-border-hover: rgba(255, 148, 176, 0.64);
  --ui-scrollbar-track: rgba(5, 10, 19, 0.96);
  --ui-scrollbar-thumb:
    linear-gradient(180deg, rgba(142, 200, 255, 0.84), rgba(81, 126, 181, 0.92));
  --ui-scrollbar-thumb-hover:
    linear-gradient(180deg, rgba(212, 239, 255, 0.95), rgba(125, 183, 255, 0.96));
  --node-link-color: #b7e1ff;
  --node-link-hover: #ffffff;
  --stroke: rgba(139, 193, 255, 0.84);
  --shadow: 0 18px 54px rgba(0, 0, 0, 0.52);
  --dd-glow:
    0 0 0 1px rgba(142, 201, 255, 0.18), 0 12px 30px rgba(0, 0, 0, 0.33),
    0 0 28px rgba(88, 152, 255, 0.16);
  --radius: 12px;
  --skin1-focus-ring: rgba(150, 210, 255, 0.8);
  --skin1-amber: rgba(241, 213, 138, 0.84);
  --skin1-motion: cubic-bezier(0.2, 0.8, 0.2, 1);
  --skin1-accent-rgb: 137, 194, 255;
  --skin1-soft-accent-rgb: 88, 152, 255;
  --skin1-warm-rgb: 241, 213, 138;
  --skin1-panel-border-rgb: 190, 221, 255;
  --skin1-muted-rgb: 203, 216, 235;
  --plus-bg-a: #06101f;
  --plus-bg-b: #0c1930;
  --plus-bg-c: #182c48;
  color-scheme: dark;
}
.app.theme-skin1,
:root.theme-skin1,
.app.theme-skin2,
:root.theme-skin2 {
  --skin-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --skin-ease-snap: cubic-bezier(0.2, 0.8, 0.2, 1);
  --skin-motion-fast: 120ms;
  --skin-motion-menu: 140ms;
  --skin-motion-panel: 190ms;
  --skin-motion-modal: 175ms;
  --skin-scale-start: 0.965;
  --skin-panel-scale-start: 0.982;
  --skin-dropdown-y-start: -6px;
}
html,
body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font);
  overflow: hidden;
  touch-action: pan-x pan-y;
  scrollbar-color: var(--ui-accent-border) var(--ui-scrollbar-track);
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--ui-scrollbar-track);
}

::-webkit-scrollbar-thumb {
  border-radius: 999px;
  border: 2px solid var(--ui-scrollbar-track);
  background: var(--ui-scrollbar-thumb);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ui-scrollbar-thumb-hover);
}
.app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}
.app.hud-hidden .hud {
  display: none;
}
.srOnly {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
a:not(.btn) {
  color: var(--link-color);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:not(.btn):visited {
  color: var(--link-visited);
}
a:not(.btn):hover {
  color: var(--link-hover);
}
a:not(.btn):focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.7);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Topbar and dropdown menus --- */
.topbar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--ui-border);
  background: var(--ui-topbar-bg);
  user-select: none;
  flex-wrap: wrap;
}
.topbar .brandHeader {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
}
.topbar .brandRoundLogo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}
.topbar .brandCopy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.1;
}
.topbar .title {
  font-weight: 700;
}
.topbar .hint {
  color: var(--muted);
  font-size: 12px;
}
.topbar .spacer {
  flex: 1;
}
@media (min-width: 901px) {
  .topbarActions {
    gap: 10px;
  }
  .topbarActions #btnFileMenu,
  .topbarActions #btnSettings,
  .topbarActions #btnHelp,
  .topbarActions #btnPlanPresentation,
  .topbarActions #btnAIPanel {
    width: 112px;
    min-width: 112px;
  }
  .topbarGroupSeparator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    color: var(--muted);
    font: 800 13px var(--mono);
    user-select: none;
  }
}
.topbarActions #btnAIPanel,
.topbarActions #btnPlanPresentation,
.topbarActions #btnFileMenu,
.topbarActions #btnSettings,
.topbarActions #btnHelp {
  border-radius: 7px;
}
.langTopWrap {
  display: inline-flex;
  align-items: center;
}
.langSelect {
  appearance: none;
  border: 1px solid var(--ui-button-border);
  background-color: var(--ui-button-bg);
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(180, 238, 252, 0.92) 50%),
    linear-gradient(135deg, rgba(180, 238, 252, 0.92) 50%, transparent 50%),
    linear-gradient(
      to right,
      rgba(180, 238, 252, 0.34),
      rgba(180, 238, 252, 0.34)
    );
  background-position:
    calc(100% - 16px) calc(50% - 2px),
    calc(100% - 11px) calc(50% - 2px),
    calc(100% - 32px) 50%;
  background-size:
    5px 5px,
    5px 5px,
    1px 16px;
  background-repeat: no-repeat;
  color: var(--txt);
  border-radius: 10px;
  padding: 6px 36px 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  min-width: 110px;
}
.langSelect option,
select.edgeLabelInput option {
  background: var(--ui-menu-bg);
  color: var(--txt);
}
.langSelect:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.7);
  outline-offset: 2px;
}
select.edgeLabelInput {
  appearance: none;
  background-color: var(--ui-input-bg);
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(180, 238, 252, 0.92) 50%),
    linear-gradient(135deg, rgba(180, 238, 252, 0.92) 50%, transparent 50%),
    linear-gradient(
      to right,
      rgba(180, 238, 252, 0.34),
      rgba(180, 238, 252, 0.34)
    );
  background-position:
    calc(100% - 16px) calc(50% - 2px),
    calc(100% - 11px) calc(50% - 2px),
    calc(100% - 32px) 50%;
  background-size:
    5px 5px,
    5px 5px,
    1px 16px;
  background-repeat: no-repeat;
  padding-right: 36px;
}
.topbar-sep {
  width: 1px;
  height: 24px;
  background: rgba(128, 128, 128, 0.3);
  margin: 0 8px;
}
.menuWrap {
  position: relative;
}
.menuTrigger {
  min-width: 86px;
}
.menuList {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 80;
  min-width: 184px;
  max-width: min(92vw, 320px);
  border-radius: 14px;
  border: 1px solid var(--ui-border-strong);
  background: var(--ui-menu-bg);
  box-shadow: var(--shadow);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.menuList[hidden] {
  display: none !important;
}
.menuList.fileMenu {
  min-width: 218px;
}
.menuItem {
  width: 100%;
  justify-content: flex-start;
  border-radius: 10px;
  padding: 7px 10px;
}
.menuItemKbd {
  margin-left: auto;
  font: 700 11px var(--mono);
  color: var(--muted);
}
.menuDivider {
  height: 1px;
  background: var(--ui-border);
  margin: 2px 0;
}
.submenuWrap {
  position: relative;
}
.submenuTrigger {
  justify-content: space-between;
}
.submenuList {
  position: absolute;
  left: calc(100% + 8px);
  right: auto;
  top: 0;
  z-index: 90;
  min-width: 186px;
  max-width: min(84vw, 280px);
  border-radius: 14px;
  border: 1px solid var(--ui-border-strong);
  background: var(--ui-menu-bg);
  box-shadow: var(--shadow);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.submenuList[hidden] {
  display: none !important;
}
#fileMenuWrap.submenu-open-left .submenuList {
  right: calc(100% + 8px);
  left: auto;
}
.menuWrap.open > .menuTrigger {
  border-color: var(--ui-button-border-hover);
  box-shadow: var(--dd-glow);
  background: var(--ui-button-bg-hover);
}
.submenuWrap.open > .submenuTrigger {
  border-color: var(--ui-button-border-hover);
  box-shadow: var(--dd-glow);
  background: var(--ui-button-bg-hover);
}
:root:is(.theme-skin1, .theme-skin2) .topbar {
  position: relative;
  z-index: 160;
  border-bottom-color: rgba(var(--skin1-panel-border-rgb), 0.16);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.035) inset,
    0 14px 38px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(14px) saturate(1.08);
}
:root:is(.theme-skin1, .theme-skin2) .topbar .brandRoundLogo {
  filter: drop-shadow(0 0 14px rgba(var(--skin1-accent-rgb), 0.13));
}
:root:is(.theme-skin1, .theme-skin2) .topbar .title {
  letter-spacing: 0;
}
:root:is(.theme-skin1, .theme-skin2) .topbar .hint,
:root:is(.theme-skin1, .theme-skin2) .hudMapName,
:root:is(.theme-skin1, .theme-skin2) .brandFloatingInfo {
  color: rgba(var(--skin1-muted-rgb), 0.72);
}
:root:is(.theme-skin1, .theme-skin2) .langSelect,
:root:is(.theme-skin1, .theme-skin2) select.edgeLabelInput {
  letter-spacing: 0;
  background-color: var(--ui-input-bg-strong);
  border-color: var(--ui-button-border);
}
:root:is(.theme-skin1, .theme-skin2) .menuList,
:root:is(.theme-skin1, .theme-skin2) .submenuList,
:root:is(.theme-skin1, .theme-skin2) .contextMenu {
  z-index: 190;
  pointer-events: auto;
  border-color: rgba(var(--skin1-panel-border-rgb), 0.2);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 42%),
    var(--ui-menu-bg);
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(var(--skin1-accent-rgb), 0.055);
  backdrop-filter: blur(18px) saturate(1.08);
  transform-origin: top right;
}
:root:is(.theme-skin1, .theme-skin2) .menuList:not([hidden]) {
  animation: skinDropdownIn var(--skin-motion-menu) var(--skin-ease-snap);
}
:root:is(.theme-skin1, .theme-skin2) .submenuList:not([hidden]) {
  animation: skinMenuPop var(--skin-motion-fast) var(--skin-ease-snap);
  transform-origin: top left;
}
:root:is(.theme-skin1, .theme-skin2) .contextMenu:not([hidden]) {
  animation: skinContextMenuIn var(--skin-motion-menu) var(--skin-ease-snap);
  transform-origin: var(--skin-context-origin-x, 12px) var(--skin-context-origin-y, 12px);
}
:root:is(.theme-skin1, .theme-skin2) .menuItem,
:root:is(.theme-skin1, .theme-skin2) .contextMenuItem {
  transition:
    transform var(--skin-motion-fast) var(--skin-ease-snap),
    background var(--skin-motion-menu) var(--skin-ease-out),
    border-color var(--skin-motion-menu) var(--skin-ease-out);
}
:root:is(.theme-skin1, .theme-skin2) .menuItem:hover,
:root:is(.theme-skin1, .theme-skin2) .contextMenuItem:hover {
  transform: translateX(1px);
  background: var(--ui-surface-soft-hover);
}
.contextMenu {
  position: fixed;
  z-index: 120;
  min-width: 176px;
  max-width: min(88vw, 240px);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--ui-border-strong);
  border-radius: 10px;
  background: var(--ui-menu-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.contextMenu[hidden] {
  display: none !important;
}
.contextMenuItem {
  width: 100%;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--txt);
  font: 700 12px var(--font);
  text-align: left;
  cursor: pointer;
}
.contextMenuItem:hover,
.contextMenuItem:focus-visible {
  outline: none;
  border-color: var(--ui-button-border-hover);
  background: var(--ui-surface-soft-hover);
}
.contextMenuItem:disabled {
  opacity: 0.42;
  cursor: default;
}
.contextMenuItem:disabled:hover {
  border-color: transparent;
  background: transparent;
}
.contextMenuItem.danger {
  color: #ffb7b7;
}
.contextMenuItem.danger:hover,
.contextMenuItem.danger:focus-visible {
  border-color: var(--ui-danger-border-hover);
  background: var(--ui-danger-bg-hover);
}
.contextMenuState {
  margin-left: auto;
  color: var(--muted);
  font: 700 11px var(--mono);
}
.contextMenuDivider {
  height: 1px;
  margin: 3px 2px;
  background: var(--ui-border);
}

.contextMenuSubmenuWrap {
  position: relative;
}

.contextMenuItem.has-submenu {
  padding-right: 8px;
}

.contextMenuSubmenu {
  display: none;
  flex-direction: column;
  gap: 4px;
  margin: 3px 0 2px 10px;
  padding-left: 7px;
  border-left: 1px solid var(--ui-border);
}

.contextMenuSubmenuWrap.open .contextMenuSubmenu {
  display: flex;
}

/* --- Shared button styles --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  appearance: none;
  border: 1px solid var(--ui-button-border);
  background: var(--ui-button-bg);
  color: var(--txt);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.3px;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.5s ease,
    border-color 0.4s ease,
    background 0.2s ease;
}
.btn:hover {
  transform: translateY(-1px);
  border-color: var(--ui-button-border-hover);
  box-shadow: var(--dd-glow);
  background: var(--ui-button-bg-hover);
}
.btn:active {
  transform: translateY(0);
}
.btn:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.7);
  outline-offset: 2px;
}
.btn.small {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}
.btn.danger {
  border-color: var(--ui-danger-border);
  background: var(--ui-danger-bg);
}
.btn.danger:hover {
  border-color: var(--ui-danger-border-hover);
  box-shadow:
    0 0 18px rgba(255, 120, 120, 0.24),
    0 0 36px rgba(255, 90, 90, 0.16);
  background: var(--ui-danger-bg-hover);
}
.btn.active {
  outline: 2px solid rgba(34, 211, 238, 0.65);
  box-shadow: var(--dd-glow);
}
.mode-btn {
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 8px 14px;
}
.mode-btn.active {
  background: var(--ui-accent-bg-soft);
  border-color: var(--ui-accent-border);
  box-shadow: 0 0 0 2px rgba(124, 192, 255, 0.25) inset;
}

:root:is(.theme-skin1, .theme-skin2) .btn {
  border-radius: 9px;
  letter-spacing: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 46%),
    var(--ui-button-bg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.065),
    0 1px 0 rgba(255, 255, 255, 0.035);
  transition:
    transform 160ms var(--skin1-motion),
    box-shadow 220ms var(--skin1-motion),
    border-color 180ms var(--skin1-motion),
    background 180ms var(--skin1-motion),
    color 180ms var(--skin1-motion);
}
:root:is(.theme-skin1, .theme-skin2) .btn.small {
  border-radius: 8px;
}
:root:is(.theme-skin1, .theme-skin2) .btn:hover {
  transform: translateY(-1px);
  border-color: var(--ui-button-border-hover);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 44%),
    var(--ui-button-bg-hover);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 8px 22px rgba(0, 0, 0, 0.24),
    0 0 22px rgba(var(--skin1-soft-accent-rgb), 0.12);
}
:root:is(.theme-skin1, .theme-skin2) .btn:active {
  transform: translateY(0) scale(0.985);
  transition-duration: 80ms;
}
:root:is(.theme-skin1, .theme-skin2) .btn:focus-visible,
:root:is(.theme-skin1, .theme-skin2) a:not(.btn):focus-visible,
:root:is(.theme-skin1, .theme-skin2) .edgeLabelInput:focus,
:root:is(.theme-skin1, .theme-skin2) .jsonEditorArea:focus,
:root:is(.theme-skin1, .theme-skin2) .plusLoginInput:focus {
  outline: 2px solid var(--skin1-focus-ring);
  outline-offset: 2px;
  box-shadow:
    0 0 0 4px rgba(var(--skin1-accent-rgb), 0.12),
    0 0 24px rgba(var(--skin1-accent-rgb), 0.14);
}
:root:is(.theme-skin1, .theme-skin2) .btn.active,
:root:is(.theme-skin1, .theme-skin2) .mode-btn.active,
:root:is(.theme-skin1, .theme-skin2) .helpTab.active,
:root:is(.theme-skin1, .theme-skin2) .settingsTab.active,
:root:is(.theme-skin1, .theme-skin2) .themeOption.active {
  border-color: var(--ui-accent-border);
  background:
    linear-gradient(180deg, rgba(255, 224, 163, 0.075), transparent 48%),
    var(--ui-accent-bg);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.045),
    0 0 0 1px rgba(var(--skin1-accent-rgb), 0.16),
    0 0 24px rgba(var(--skin1-accent-rgb), 0.13);
}
:root:is(.theme-skin1, .theme-skin2) .mode-btn {
  letter-spacing: 0;
}
:root:is(.theme-skin1, .theme-skin2) .themePicker .themeOptionPremium {
  grid-column: 1 / -1;
  min-height: 36px;
  border-color: rgba(var(--skin1-warm-rgb), 0.36);
  background:
    linear-gradient(135deg, rgba(var(--skin1-accent-rgb), 0.14), rgba(var(--skin1-warm-rgb), 0.085)),
    var(--ui-button-bg);
}

/* --- Canvas stage, world transform, and layered render surfaces --- */
.stage {
  position: relative;
  flex: 1;
  background:
    radial-gradient(
      1200px 800px at 72% 18%,
      var(--stage-radial-a),
      transparent 55%
    ),
    radial-gradient(
      900px 700px at 18% 72%,
      var(--stage-radial-b),
      transparent 55%
    ),
    linear-gradient(to bottom, var(--stage-fade-top), var(--stage-fade-bottom));
  overflow: hidden;
}
.worldGrid {
  position: absolute;
  inset: 0;
  --snap-grid-minor-size: 20px;
  --snap-grid-major-size: 100px;
  --snap-grid-minor-offset-x: 0px;
  --snap-grid-minor-offset-y: 0px;
  --snap-grid-major-offset-x: 0px;
  --snap-grid-major-offset-y: 0px;
  --snap-grid-line-width: 1px;
  background:
    linear-gradient(
      to right,
      var(--grid) var(--snap-grid-line-width),
      transparent var(--snap-grid-line-width)
    ),
    linear-gradient(
      to bottom,
      var(--grid) var(--snap-grid-line-width),
      transparent var(--snap-grid-line-width)
    ),
    linear-gradient(
      to right,
      var(--grid2) var(--snap-grid-line-width),
      transparent var(--snap-grid-line-width)
    ),
    linear-gradient(
      to bottom,
      var(--grid2) var(--snap-grid-line-width),
      transparent var(--snap-grid-line-width)
    );
  background-size:
    var(--snap-grid-major-size) var(--snap-grid-major-size),
    var(--snap-grid-major-size) var(--snap-grid-major-size),
    var(--snap-grid-minor-size) var(--snap-grid-minor-size),
    var(--snap-grid-minor-size) var(--snap-grid-minor-size);
  background-position:
    var(--snap-grid-major-offset-x) var(--snap-grid-major-offset-y),
    var(--snap-grid-major-offset-x) var(--snap-grid-major-offset-y),
    var(--snap-grid-minor-offset-x) var(--snap-grid-minor-offset-y),
    var(--snap-grid-minor-offset-x) var(--snap-grid-minor-offset-y);
  pointer-events: none;
  opacity: 0.82;
  z-index: 0;
}
.app.snap-grid-on .worldGrid {
  opacity: 0.94;
}
.app.grid-hidden .worldGrid {
  opacity: 0;
}
.viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}

.viewport:active {
  cursor: grabbing;
}

.viewport.is-panning {
  cursor: grabbing !important;
}
.world {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  z-index: 1;
}
#groupsLayer {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 10;
}
svg#edgesSvg,
svg#edgeHandlesSvg {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
  pointer-events: none;
}
svg#edgesSvg {
  z-index: 20;
}
#nodesLayer {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 30;
}
svg#edgeHandlesSvg {
  z-index: 40;
}

/* --- Links (edges), hit targets, labels, and endpoint handles --- */
.edge {
  stroke: var(--stroke);
  stroke-width: 3.4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.95;
  pointer-events: none;
}
.edge-hit {
  stroke: transparent;
  stroke-width: 14;
  fill: none;
  pointer-events: stroke;
  cursor: move;
}
.edge.is-selected {
  stroke: #ff92c8;
  stroke-dasharray: 7 4;
  stroke-width: 4.8;
}
.edge-hit:hover + .edge {
  stroke-width: 4.2;
}
.edge-hit:hover + .edge.is-selected {
  stroke-width: 5.2;
}
.edgeLabel {
  fill: rgba(255, 255, 255, 0.85);
  font-size: 18px;
  font-weight: 600;
  font-family: var(--font);
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.65);
  stroke-width: 4px;
  pointer-events: all;
  cursor: text;
}
.edge-endpoint {
  pointer-events: all;
  fill: #c8b2f7;
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 2.2px;
  cursor: pointer;
  filter: drop-shadow(0 0 10px rgba(190, 136, 255, 0.7))
    drop-shadow(0 0 20px rgba(138, 88, 226, 0.45));
  animation: endpointPulse 1.6s ease-in-out infinite;
}
.edge-endpoint:hover {
  filter: drop-shadow(0 0 14px rgba(208, 162, 255, 0.85))
    drop-shadow(0 0 26px rgba(153, 106, 235, 0.58));
}
@keyframes endpointPulse {
  0% {
    stroke-width: 2px;
  }
  50% {
    stroke-width: 3px;
  }
  100% {
    stroke-width: 2px;
  }
}

.selectionRect {
  position: absolute;
  z-index: 55;
  pointer-events: none;
  border: 2px solid #22d3ee;
  background: transparent;
  box-sizing: border-box;
  box-shadow: 0 0 0 1px rgba(10, 14, 26, 0.72);
}

/* --- Card/group nodes, ports, and inline editors --- */
.node {
  position: absolute;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--node-border);
  background: linear-gradient(180deg, var(--node-bg-a), var(--node-bg-b));
  overflow: hidden;
  contain: layout paint;
}
.app.node-translucency-off .node:not(.group) {
  background: linear-gradient(180deg, rgba(55, 43, 86, 1), rgba(33, 27, 56, 1));
}
.app.node-translucency-off .node.group {
  background: rgba(70, 55, 108, 0.44);
}
.app.theme-skin1.node-translucency-off .node:not(.group),
.app.theme-skin2.node-translucency-off .node:not(.group) {
  background: linear-gradient(180deg, var(--node-bg-a), var(--node-bg-b));
}
.app.theme-skin1.node-translucency-off .node.group,
.app.theme-skin2.node-translucency-off .node.group {
  background: var(--group-bg);
}
.node.selected {
  outline: 2px solid var(--node-accent, rgba(186, 151, 255, 0.86));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.16),
    0 0 24px var(--node-glow, rgba(177, 136, 247, 0.35)),
    var(--shadow);
  filter: saturate(1.12);
}
.node.group {
  background: var(--group-bg);
  border: 2px dashed var(--group-border);
  box-shadow: none;
  cursor: move;
}
.node .hdr {
  padding: 10px 12px;
  border-bottom: 1px solid var(--node-header-border);
  background: var(--node-header-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  user-select: none;
  cursor: move;
}
.node.group .hdr {
  border-bottom: none;
  cursor: move;
}
.node .hdr .id {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--node-muted);
}
.node .hdr .label {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--node-text);
}
.node .body {
  flex: 1;
  min-height: 0;
  padding: 11px 12px 13px;
  font-size: 13.5px;
  line-height: 1.42;
  color: var(--node-text);
  word-wrap: break-word;
  max-height: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}
.node:not(.group) .body {
  cursor: move;
  overscroll-behavior: contain;
}
.node.editing-content .body,
.node .body.is-editing {
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
  touch-action: pan-y;
}
.node:not(.group):not(.selected) .body {
  touch-action: none;
}
.node:not(.group).selected .body {
  touch-action: none;
}
.node:not(.group).touch-dragging .body {
  touch-action: none;
}
.node:not(.group) .body:active {
  cursor: grabbing;
}

.node.summaryNodeScrollable .body {
  overflow-y: auto;
  max-height: 360px;
}
.node.group .body {
  display: none;
}

.node.group:active,
.node.group.touch-dragging {
  cursor: grabbing;
}
:root:is(.theme-skin1, .theme-skin2) .stage {
  background:
    radial-gradient(
      980px 680px at 74% 18%,
      rgba(93, 229, 201, 0.13),
      transparent 58%
    ),
    radial-gradient(
      760px 620px at 16% 74%,
      rgba(var(--skin1-warm-rgb), 0.08),
      transparent 54%
    ),
    linear-gradient(to bottom, var(--stage-fade-top), var(--stage-fade-bottom));
}
:root:is(.theme-skin1, .theme-skin2) .worldGrid {
  opacity: 0.78;
}
:root:is(.theme-skin1, .theme-skin2) .app.snap-grid-on .worldGrid,
.app.theme-skin1.snap-grid-on .worldGrid,
.app.theme-skin2.snap-grid-on .worldGrid {
  opacity: 0.9;
}
:root:is(.theme-skin1, .theme-skin2) .node:not(.group) {
  box-shadow:
    0 16px 38px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(255, 255, 255, 0.025);
}
:root:is(.theme-skin1, .theme-skin2) .node.selected {
  outline-color: var(--node-accent, rgba(var(--skin1-accent-rgb), 0.86));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.16),
    0 0 0 4px rgba(var(--skin1-accent-rgb), 0.08),
    0 0 28px var(--node-glow, rgba(var(--skin1-accent-rgb), 0.24)),
    0 18px 42px rgba(0, 0, 0, 0.42);
  filter: saturate(1.08);
}
:root:is(.theme-skin1, .theme-skin2) .node .hdr {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    var(--node-header-bg);
}
:root:is(.theme-skin1, .theme-skin2) .node .hdr .label {
  letter-spacing: 0;
}
:root:is(.theme-skin1, .theme-skin2) .port {
  background: rgba(155, 248, 229, 0.98);
  border-color: rgba(244, 255, 252, 0.82);
  box-shadow:
    0 0 0 3px rgba(var(--skin1-accent-rgb), 0.08),
    0 0 13px rgba(var(--skin1-accent-rgb), 0.34);
}
.port {
  position: absolute;
  right: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: rgba(219, 193, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 10px rgba(176, 124, 247, 0.36);
  cursor: crosshair;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}
.port.port-left {
  right: auto;
  left: 3px;
}
.port.port-top {
  top: 3px;
  right: 50%;
  transform: translateX(50%);
}
.port.port-bottom {
  top: auto;
  bottom: 3px;
  right: 50%;
  transform: translateX(50%);
}
.editor {
  position: absolute;
  inset: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(14, 18, 32, 0.94);
  color: var(--node-text);
  font: 12px/1.35 var(--mono);
  padding: 8px;
  resize: none;
  overflow: auto;
  touch-action: pan-y;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  outline: none;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}
.visualNodeEditorWrap,
.markdownFallbackEditorWrap {
  width: 100%;
  min-height: 100%;
  display: block;
  border: 0;
  background: transparent;
  padding: 0;
  z-index: 4;
}
.visualNodeEditor {
  min-height: 100%;
  overflow: visible;
  border-radius: 0;
  background: transparent;
  color: var(--node-text);
  font: inherit;
  padding: 0;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
  cursor: text;
}
.visualNodeEditor p,
.visualNodeEditor h1,
.visualNodeEditor h2,
.visualNodeEditor h3,
.visualNodeEditor ul,
.visualNodeEditor ol {
  margin: 4px 0;
}

.visualNodeEditor ul,
.visualNodeEditor ol {
  padding-left: 20px;
}
.visualNodeEditor ul.visualTextAlign-center,
.visualNodeEditor ol.visualTextAlign-center,
.node .body ul.visualTextAlign-center,
.node .body ol.visualTextAlign-center {
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.35em;
  text-align: left;
}
.visualNodeEditor ul.visualTextAlign-right,
.visualNodeEditor ol.visualTextAlign-right,
.node .body ul.visualTextAlign-right,
.node .body ol.visualTextAlign-right {
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  margin-right: 0;
  padding-left: 1.35em;
  text-align: left;
}
.visualNodeToolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.visualNodeToolbarDock {
  position: absolute;
  left: 50%;
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + var(--visual-keyboard-inset, 0px));
  transform: translateX(-50%);
  z-index: 48;
  max-width: min(760px, calc(100% - 28px));
  padding: 7px;
  border: 1px solid rgba(34, 211, 238, 0.74);
  border-radius: 9px;
  background: var(--ui-menu-bg);
  box-shadow:
    0 0 0 1px rgba(88, 225, 205, 0.18),
    0 0 18px rgba(34, 211, 238, 0.22),
    var(--shadow);
}

.visualNodeToolbarDock[hidden] {
  display: none;
}

.visualNodeToolbarDock .visualNodeToolbar {
  justify-content: center;
}

.visual-keyboard-open .visualNodeToolbarDock {
  z-index: 68;
}

.visualNodeTool {
  min-width: 34px;
  min-height: 31px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
  color: var(--txt);
  font: 700 11px/1 var(--font);
  cursor: pointer;
}
.visualNodeTool:hover,
.visualNodeTool:focus-visible {
  border-color: rgba(201, 177, 255, 0.58);
  background: rgba(190, 162, 255, 0.16);
  outline: none;
}
.visualNodeTool-italic {
  font-style: italic;
  font-size: 15px;
}
.visualNodeTool-underline {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.visualNodeColorTool {
  min-width: 31px;
  padding-inline: 8px;
}

.visualColorSwatch {
  display: block;
  width: 13px;
  height: 13px;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.26);
}

.visualColorSwatch.swatch-white {
  background: #fff;
}

.visualColorSwatch.swatch-black {
  background: #05070b;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.42),
    inset 0 0 0 1px rgba(0, 0, 0, 0.72);
}

.visualNodeToolMenu {
  position: relative;
  display: inline-flex;
}

.visualNodeToolMenuTrigger::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 6px;
  vertical-align: middle;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.72;
}

.visualNodeToolMenuPanel {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  display: none;
  gap: 5px;
  align-items: center;
  padding: 6px;
  border: 1px solid rgba(88, 225, 205, 0.44);
  border-radius: 8px;
  background: rgba(12, 17, 29, 0.98);
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.34),
    0 0 18px rgba(88, 225, 205, 0.12);
  z-index: 88;
  white-space: nowrap;
}

.visualNodeToolMenu.open .visualNodeToolMenuPanel {
  display: inline-flex;
}

.visualNodeListMenu .visualNodeToolMenuPanel {
  min-width: 238px;
}

.visualNodeAlignTool {
  display: inline-grid;
  gap: 2px;
  place-content: center;
}

.visualNodeAlignTool span {
  display: block;
  height: 2px;
  width: 14px;
  border-radius: 999px;
  background: currentColor;
}

.visualNodeAlignTool span:nth-child(2) {
  width: 10px;
}

.visualNodeAlignTool.align-center span {
  margin-inline: auto;
}

.visualNodeAlignTool.align-right span {
  margin-left: auto;
}

.visualAlignedBlock {
  min-width: 100%;
}
.visualTextAlign-left {
  text-align: left;
}
.visualTextAlign-center {
  text-align: center;
}
.visualTextAlign-right {
  text-align: right;
}
.visualColor-white,
.nodeInlineColor-white {
  color: #fff;
}
.visualColor-black,
.nodeInlineColor-black {
  color: #050505;
}
.visualAccountImageToken {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin: 6px 0;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px dashed var(--ui-border);
  color: var(--node-muted);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.04);
}
.visualNodeEditor .visualAccountImageToken.nodeRichImageWrap {
  display: flex;
  padding: 0;
  border: 0;
  color: inherit;
  font: inherit;
  background: transparent;
  cursor: default;
}
.markdownFallbackEditorWrap {
  padding-top: 6px;
}
.markdownFallbackNote {
  flex: none;
  color: var(--node-muted);
  font-size: 10.5px;
  line-height: 1.25;
}
.markdownFallbackEditor {
  position: static;
  inset: auto;
  width: 100%;
  height: auto;
  flex: 1;
}
.node.selected .port {
  opacity: 1;
  pointer-events: auto;
}

.group-label-editor {
  position: absolute;
  inset: 8px 8px auto 8px;
  width: calc(100% - 16px);
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(14, 18, 32, 0.94);
  color: var(--node-text);
  font: 700 13px var(--font);
  padding: 0 4px;
  outline: none;
}
.welcome-brand {
  margin-top: 10px;
  font-size: 11px;
  opacity: 0.9;
}
.welcome-brand a {
  color: #9dc0ff;
  text-decoration: none;
}
.app.theme-light .editor,
.app.theme-light .group-label-editor {
  background: rgba(242, 244, 252, 0.96);
  border-color: rgba(126, 132, 158, 0.42);
}
.app.theme-light .visualNodeEditorWrap,
.app.theme-light .markdownFallbackEditorWrap {
  background: transparent;
  border-color: transparent;
}
.app.theme-light .visualNodeEditor {
  background: transparent;
}
.app.theme-light .visualNodeTool {
  color: var(--txt);
  background: rgba(48, 58, 88, 0.06);
  border-color: rgba(82, 92, 130, 0.24);
}
.app.theme-light .visualNodeTool-black {
  color: #111;
  background: rgba(255, 255, 255, 0.86);
}
.welcome-brand a:hover {
  text-decoration: underline;
}

/* --- Preset palette color classes --- */
.node:not(.group).c1 {
  border-color: rgba(182, 131, 78, 0.78);
  background: linear-gradient(
    180deg,
    rgba(182, 131, 78, 0.72),
    rgba(121, 84, 46, 0.56)
  );
}
.node:not(.group).c2 {
  border-color: rgba(63, 141, 147, 0.78);
  background: linear-gradient(
    180deg,
    rgba(63, 141, 147, 0.72),
    rgba(37, 92, 96, 0.56)
  );
}
.node:not(.group).c3 {
  border-color: rgba(77, 138, 103, 0.78);
  background: linear-gradient(
    180deg,
    rgba(77, 138, 103, 0.72),
    rgba(48, 91, 67, 0.56)
  );
}
.node:not(.group).c4 {
  border-color: rgba(122, 97, 184, 0.8);
  background: linear-gradient(
    180deg,
    rgba(122, 97, 184, 0.74),
    rgba(79, 60, 128, 0.58)
  );
}
.node:not(.group).c5 {
  border-color: rgba(79, 115, 181, 0.78);
  background: linear-gradient(
    180deg,
    rgba(79, 115, 181, 0.72),
    rgba(50, 73, 121, 0.56)
  );
}
.node:not(.group).c6 {
  border-color: rgba(160, 90, 128, 0.78);
  background: linear-gradient(
    180deg,
    rgba(160, 90, 128, 0.72),
    rgba(104, 57, 84, 0.56)
  );
}
.node.group.c1 {
  border-color: rgba(182, 131, 78, 0.9);
}
.node.group.c2 {
  border-color: rgba(63, 141, 147, 0.9);
}
.node.group.c3 {
  border-color: rgba(77, 138, 103, 0.9);
}
.node.group.c4 {
  border-color: rgba(122, 97, 184, 0.9);
}
.node.group.c5 {
  border-color: rgba(79, 115, 181, 0.9);
}
.node.group.c6 {
  border-color: rgba(160, 90, 128, 0.9);
}
.app.theme-light .welcome-brand a {
  color: #2f5d9a;
}

/* --- HUD, toast, and floating tool panels --- */
.hud {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: 16px;
  padding: 10px;
  box-shadow: var(--shadow);
}
.hud .row {
  display: flex;
  gap: 8px;
}
.hud .k {
  color: var(--muted);
  font-size: 11px;
  width: 96px;
}
.hud .v {
  font-family: var(--mono);
  font-size: 11px;
}
.hudMapName {
  font-size: 11px;
  color: rgba(210, 178, 255, 0.7);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-left: auto;
}
.toast {
  position: absolute;
  left: 12px;
  bottom: 12px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: 16px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  color: rgba(255, 255, 255, 0.85);
  max-width: 560px;
  font-size: 12px;
}
.viewTools {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 45;
  align-items: stretch;
}
.viewTools .btn {
  min-width: 78px;
}
.quickTools {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 40;
  align-items: stretch;
  overflow: visible;
}
.quickTools .btn {
  min-width: 72px;
}
.presentationPlannerPanel {
  position: absolute;
  top: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 74;
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100vw - 28px));
  border: 1px solid var(--ui-border);
  border-radius: 14px;
  background: var(--ui-surface-strong);
  box-shadow: var(--shadow);
  color: var(--txt);
  overflow: hidden;
  transition: transform 0.2s ease, visibility 0.2s ease;
  transform: translateX(0);
}
.presentationPlannerPanel[hidden] {
  display: flex !important;
  transform: translateX(calc(100% + 14px));
  pointer-events: none;
  visibility: hidden;
}
.presentationPlannerHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--ui-border);
}
.presentationPlannerHeader h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}
.presentationPlannerActions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--ui-border);
}
.presentationPlannerActions .btn {
  min-height: 36px;
  min-width: 0;
  white-space: normal;
}
.presentationPlannerStatus {
  margin: 10px 12px 0;
  padding: 8px 10px;
  border: 1px solid var(--ui-accent-border-soft);
  border-radius: 10px;
  background: var(--ui-accent-bg-soft);
  color: var(--txt);
  font-size: 12px;
  line-height: 1.35;
}
.presentationPlannerStatus[hidden] {
  display: none;
}
.presentationPlannerList {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 12px;
  overflow: auto;
}
.presentationPlannerEmpty {
  color: var(--muted);
  font-size: 12px;
  list-style: none;
}
.presentationPlannerStep {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: var(--ui-surface-soft);
  list-style: none;
}
.presentationPlannerStep.is-missing {
  border-color: var(--ui-danger-border);
  background: var(--ui-danger-bg);
}
.presentationPlannerStepMain {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.presentationPlannerNumber,
.presentationAgendaNumber {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--ui-border-strong);
  color: var(--muted);
  font: 800 11px var(--mono);
}
.presentationPlannerLabelInput {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: var(--ui-input-bg);
  color: var(--txt);
  padding: 7px 9px;
  font: 600 12px var(--font);
}
.presentationPlannerLabelInput:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.7);
  outline-offset: 2px;
}
.presentationPlannerLabelInput:disabled {
  opacity: 0.74;
}
.presentationPlannerType,
.presentationAgendaType {
  color: var(--muted);
  font: 800 10px var(--mono);
  text-transform: uppercase;
}
.presentationPlannerStepActions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.presentationPlannerStepActions .btn {
  min-width: 0;
  padding-inline: 6px;
}
.presentationOverlay {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 80;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  align-items: center;
  width: min(760px, calc(100vw - 28px));
  transform: translateX(-50%);
  padding: 10px 12px;
  border: 1px solid var(--ui-border);
  border-radius: 14px;
  background: var(--ui-surface-strong);
  box-shadow: var(--shadow);
  color: var(--txt);
}
.presentationOverlay[hidden] {
  display: none;
}
.presentationMeta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 110px;
}
.presentationBadge {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-transform: uppercase;
}
.presentationStepCount {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--txt);
}
.presentationControls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.presentationControls .btn {
  min-width: 78px;
}
.presentationAgenda {
  grid-column: 1 / -1;
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: var(--ui-surface);
  overflow: hidden;
}
.presentationAgenda[hidden] {
  display: none;
}
.presentationAgendaHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--ui-border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.presentationAgendaList {
  display: grid;
  gap: 4px;
  max-height: min(36vh, 260px);
  margin: 0;
  padding: 8px;
  overflow: auto;
}
.presentationAgendaItem {
  list-style: none;
}
.presentationAgendaStep {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--txt);
  padding: 7px;
  text-align: left;
  cursor: pointer;
}
.presentationAgendaStep:hover,
.presentationAgendaStep:focus-visible {
  border-color: var(--ui-button-border-hover);
  background: var(--ui-surface-soft-hover);
  outline: none;
}
.presentationAgendaItem.is-current .presentationAgendaStep {
  border-color: var(--ui-accent-border);
  background: var(--ui-accent-bg-soft);
}
.presentationAgendaItem.is-missing .presentationAgendaStep {
  color: var(--muted);
  cursor: default;
  opacity: 0.72;
}
.presentationAgendaLabel {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}
.presentationAgendaEmpty {
  color: var(--muted);
  font-size: 12px;
  list-style: none;
}
.presentationStatus {
  grid-column: 1 / -1;
  min-height: 16px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app.presentation-active .topbar,
.app.presentation-active .viewTools,
.app.presentation-active .quickTools,
.app.presentation-active .hud,
.app.presentation-active .brandFloatingInfo,
.app.presentation-active .aiPanel,
.app.presentation-active .presentationPlannerPanel,
.app.presentation-active .contextMenu,
.app.presentation-active .colorPanel {
  display: none !important;
}
.app.presentation-active .stage {
  background:
    radial-gradient(900px 620px at 52% 22%, var(--stage-radial-a), transparent 58%),
    linear-gradient(to bottom, var(--stage-fade-top), var(--stage-fade-bottom));
}
.app.presentation-active .node.presentationDimmed {
  opacity: 0.28;
  filter: saturate(0.72);
}
.app.presentation-active .node.presentationFocused {
  opacity: 1;
  outline: 3px solid var(--ui-accent-border);
  outline-offset: 4px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.2),
    0 0 30px var(--ui-accent-bg),
    var(--shadow);
  filter: saturate(1.08);
}
.app.presentation-active .edge.presentationDimmed,
.app.presentation-active .edge-hit.presentationDimmed {
  opacity: 0.16;
}
.app.presentation-active .edgeLabel.presentationDimmed {
  opacity: 0.28;
}
.app.presentation-active .resize-handle,
.app.presentation-active .port,
.app.presentation-active .edge-endpoint {
  display: none;
}
.app.presentation-active .node .body {
  touch-action: pan-y;
}
.colorPanel {
  position: absolute;
  right: calc(100% + 10px);
  top: 0;
  z-index: 60;
  width: 238px;
  border-radius: 14px;
  border: 1px solid var(--ui-border);
  background: var(--ui-surface-strong);
  box-shadow: var(--shadow);
  padding: 10px;
  max-height: min(62vh, 420px);
  overflow: auto;
}
.colorPanelTitle {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}
.colorSwatches {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
.colorSwatch {
  height: 24px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  cursor: pointer;
}
.colorSwatch:hover {
  box-shadow: var(--dd-glow);
}
.colorSwatch.sw-1 {
  background: #b6834e;
}
.colorSwatch.sw-2 {
  background: #3f8d93;
}
.colorSwatch.sw-3 {
  background: #4d8a67;
}
.colorSwatch.sw-4 {
  background: #7a61b8;
}
.colorSwatch.sw-5 {
  background: #4f73b5;
}
.colorSwatch.sw-6 {
  background: #a05a80;
}
.colorPickerRow {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  margin-bottom: 8px;
}
#colorPicker {
  width: 100%;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--ui-border-strong);
  background: var(--ui-surface-soft);
  padding: 0;
}
.colorPanelHint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}
.brandFloatingInfo {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  color: rgba(173, 196, 238, 0.86);
  font-size: 11px;
  z-index: 35;
  line-height: 1.3;
  text-align: center;
}
.brandFloatingInfo a {
  color: rgba(173, 196, 238, 0.92);
  text-decoration: none;
}
.brandFloatingInfo a:hover {
  color: rgba(173, 196, 238, 0.95);
  text-decoration: underline;
}

/* --- Dialog layouts and shared modal styling --- */
textarea#jsonInput,
textarea#jsonEditorInput {
  width: min(920px, 96vw);
  height: min(340px, 50vh);
  background: var(--ui-input-bg);
  color: var(--txt);
  border: 1px solid var(--ui-border);
  border-radius: 16px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.35;
  outline: none;
}
textarea#jsonEditorInput {
  height: min(560px, 62vh);
}
dialog {
  position: relative;
  border: none;
  border-radius: 18px;
  background: var(--ui-dialog-bg);
  color: var(--txt);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.65);
  padding: 14px 14px 40px;
}
dialog[open] {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  max-width: 96vw;
  max-height: calc(100dvh - 24px);
}
dialog::after {
  content: "Amethyst Mapper";
  position: absolute;
  left: 14px;
  bottom: 10px;
  color: rgba(173, 196, 238, 0.86);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2px;
}
#helpDlg {
  width: min(980px, 96vw);
}
#jsonEditorDlg {
  width: min(980px, 96vw);
}
#aboutDlg {
  width: min(686px, 92vw);
}
#welcomeDlg {
  width: min(620px, 92vw);
  padding: 18px 20px 14px;
}
#platformDlg {
  width: min(980px, 96vw);
}
#edgeLabelDlg {
  width: min(540px, 94vw);
}
#nodeJumpDlg {
  width: min(540px, 94vw);
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}
:root:is(.theme-skin1, .theme-skin2) dialog,
:root:is(.theme-skin1, .theme-skin2) .aiPanel,
:root:is(.theme-skin1, .theme-skin2) .presentationPlannerPanel,
:root:is(.theme-skin1, .theme-skin2) .colorPanel,
:root:is(.theme-skin1, .theme-skin2) .hud,
:root:is(.theme-skin1, .theme-skin2) .toast,
:root:is(.theme-skin1, .theme-skin2) .settingsInfoCard,
:root:is(.theme-skin1, .theme-skin2) .helpSection,
:root:is(.theme-skin1, .theme-skin2) .subscriptionCard,
:root:is(.theme-skin1, .theme-skin2) .platformAdminBox {
  border-color: rgba(var(--skin1-panel-border-rgb), 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 48%),
    var(--ui-surface-strong);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(var(--skin1-accent-rgb), 0.045);
}
:root:is(.theme-skin1, .theme-skin2) dialog {
  backdrop-filter: blur(18px) saturate(1.05);
}
:root:is(.theme-skin1, .theme-skin2) dialog[open] {
  animation: skinModalIn var(--skin-motion-modal) var(--skin-ease-out);
}
:root:is(.theme-skin1, .theme-skin2) #platformDlg[open],
:root:is(.theme-skin1, .theme-skin2) #helpDlg[open] {
  animation: skinPanelIn var(--skin-motion-panel) var(--skin-ease-out);
}
:root:is(.theme-skin1, .theme-skin2) .helpPanel.active,
:root:is(.theme-skin1, .theme-skin2) .settingsPanel.active {
  animation: skinInnerPanelIn var(--skin-motion-fast) var(--skin-ease-out);
}
:root:is(.theme-skin1, .theme-skin2) dialog::backdrop {
  background: rgba(2, 5, 6, 0.68);
  backdrop-filter: blur(8px);
}
:root:is(.theme-skin1, .theme-skin2) .dlgHdr {
  border-bottom: 1px solid rgba(var(--skin1-panel-border-rgb), 0.11);
  padding-bottom: 10px;
}
:root:is(.theme-skin1, .theme-skin2) .settingsInfoCard,
:root:is(.theme-skin1, .theme-skin2) .helpSection,
:root:is(.theme-skin1, .theme-skin2) .subscriptionCard,
:root:is(.theme-skin1, .theme-skin2) .platformAdminBox {
  border-radius: 12px;
}
:root:is(.theme-skin1, .theme-skin2) .settingsInfoCard h4,
:root:is(.theme-skin1, .theme-skin2) .helpSection h3,
:root:is(.theme-skin1, .theme-skin2) .presentationPlannerHeader h2 {
  letter-spacing: 0;
}
:root:is(.theme-skin1, .theme-skin2) .settingsTabs,
:root:is(.theme-skin1, .theme-skin2) .helpTabs,
:root:is(.theme-skin1, .theme-skin2) .themePicker {
  gap: 7px;
}
:root:is(.theme-skin1, .theme-skin2) .presentationPlannerPanel {
  transition:
    transform var(--skin-motion-panel) var(--skin-ease-out),
    visibility var(--skin-motion-panel) var(--skin-ease-out);
}
.dlgHdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.dlgHint {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}
.edgeLabelInput {
  width: 100%;
  box-sizing: border-box;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--ui-border-strong);
  background: var(--ui-input-bg);
  color: var(--txt);
  padding: 0 10px;
  font-size: 13px;
  outline: none;
}
.edgeLabelInput:focus {
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: var(--dd-glow);
}
.jsonEditorArea {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid var(--ui-border-strong);
  background: var(--ui-input-bg);
  color: var(--txt);
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.35;
  font-family: var(--mono);
  outline: none;
  resize: vertical;
}
.jsonEditorArea:focus {
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: var(--dd-glow);
}

/* --- Help/About content layout --- */
.helpTabs,
.settingsTabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.25rem), 1fr));
  gap: 6px;
  margin-bottom: 12px;
  padding: 3px;
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: var(--ui-surface-soft);
}
.helpTab,
.settingsTab {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  justify-content: center;
  border-color: transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
  padding: 7px 9px;
  white-space: normal;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    color 0.14s ease;
}
.helpTab:hover,
.settingsTab:hover,
.helpTab:focus-visible,
.settingsTab:focus-visible {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface-soft-hover);
  color: var(--txt);
}
.helpTab.active,
.settingsTab.active,
.themeOption.active {
  border-color: var(--ui-accent-border);
  background: var(--ui-surface-soft-active);
  color: var(--txt);
  box-shadow: 0 0 0 1px var(--ui-accent-bg-soft) inset;
}
.helpPanel,
.settingsPanel {
  display: none;
}
.helpPanel.active,
.settingsPanel.active {
  display: block;
}
.helpPanel {
  min-height: min(66vh, 700px);
  max-height: min(66vh, 700px);
  overflow: auto;
  padding-right: 6px;
}
.helpLayout {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 10px;
}
.helpManual {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 10px;
  align-items: start;
}
.helpSection {
  border-radius: 12px;
  border: 1px solid var(--ui-border);
  background: var(--ui-surface-soft);
  padding: 10px 12px;
}
.helpSectionWide {
  grid-column: 1 / -1;
}
.helpSection h3 {
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  letter-spacing: 0.2px;
  color: var(--txt);
}
.helpManual .helpSection {
  padding: 12px;
}
.helpManual .helpSection h3 {
  margin-bottom: 6px;
  font-size: 13px;
}
.helpSectionLead {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.helpStartSection {
  background:
    linear-gradient(135deg, var(--ui-accent-bg-soft), transparent 42%),
    var(--ui-surface-soft);
}
.helpSectionCopy {
  display: grid;
  gap: 8px;
}
.helpSectionCopy p {
  margin: 0;
  line-height: 1.52;
  color: var(--txt);
}
.helpList {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: var(--txt);
}
.helpRule {
  padding-top: 2px;
}
.helpSectionIcon {
  min-width: 26px;
  height: 22px;
  padding: 0 5px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ui-button-border-hover);
  background: var(--ui-accent-bg-soft);
  color: rgba(225, 247, 255, 0.96);
  font: 700 9px var(--mono);
}
.helpManual .helpSectionIcon {
  min-width: 28px;
  width: 28px;
  height: 24px;
  padding: 0;
  border-color: var(--ui-accent-border);
  background: var(--ui-accent-bg-soft);
  color: var(--txt);
  font: 700 14px/1 var(--sans);
}
.helpRows {
  display: grid;
  gap: 6px;
}
.helpRowsInset {
  margin-top: 10px;
}
.helpRow {
  display: grid;
  grid-template-columns: 124px 1fr;
  gap: 8px;
  align-items: start;
}
.helpManual .helpRow {
  grid-template-columns: minmax(126px, 0.42fr) 1fr;
  padding: 7px 0;
  border-top: 1px solid var(--ui-border);
}
.helpManual .helpRow:first-child {
  border-top: 0;
  padding-top: 0;
}
.helpKey {
  color: var(--txt);
  font-size: 11.5px;
  font-weight: 700;
}
.helpValue {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
}
.helpValue a {
  color: #9dc0ff;
  text-decoration: none;
}
.helpValue a:hover {
  text-decoration: underline;
}
.helpQuickList {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0;
}
.helpQuickList span,
.helpMiniCard,
.helpCallout,
.helpShortcut {
  border: 1px solid var(--ui-border);
  background: var(--ui-surface-soft-active);
  border-radius: 9px;
}
.helpQuickList span {
  padding: 8px 9px;
  color: var(--txt);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.25;
}
.helpGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.helpGridFour {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.helpMiniCard {
  padding: 9px 10px;
}
.helpMiniCard h4 {
  margin: 0 0 5px;
  color: var(--txt);
  font-size: 12px;
  line-height: 1.25;
}
.helpMiniCard p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}
.helpCallout {
  margin-top: 10px;
  padding: 9px 10px;
  color: var(--txt);
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 0 0 1px var(--ui-accent-bg-soft) inset;
}
.helpShortcutGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.helpShortcut {
  display: grid;
  grid-template-columns: minmax(118px, 0.42fr) 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}
.helpShortcut kbd {
  justify-self: start;
  border: 1px solid var(--ui-border-strong);
  border-radius: 7px;
  background: var(--ui-surface-soft-hover);
  color: var(--txt);
  padding: 3px 6px;
  font: 700 11px var(--mono);
  line-height: 1.2;
}
.helpShortcut span {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
}

.settingsPanelsHost {
  min-height: min(66vh, 700px);
}
.settingsPanel {
  min-height: min(66vh, 700px);
  max-height: min(66vh, 700px);
  overflow: auto;
  padding-right: 6px;
}
.settingsInfoWrap {
  display: grid;
  gap: 10px;
  align-content: start;
}
.settingsInfoCard {
  border-radius: 12px;
  border: 1px solid var(--ui-border);
  background: var(--ui-surface-soft);
  padding: 12px 14px;
}
.settingsInfoCard h4 {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.2px;
  color: var(--txt);
}
.settingsInfoCard h5 {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.2px;
}
.settingsInfoCard p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.settingsInfoCard p:last-child {
  margin-bottom: 0;
}
.subscriptionsGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 10px;
}
.subscriptionCard {
  border-radius: 12px;
  border: 1px solid var(--ui-border);
  background: var(--ui-surface-soft);
  padding: 12px 14px;
}
.supportActions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.supportStatus {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
}

.supportStatus.error {
  color: #ff9bb2;
}

.supportStatus.success {
  color: #9de9b0;
}
.supportActions .btn {
  min-width: 160px;
}
.supportMeta {
  margin-top: 8px !important;
}
.inlineLinkBtn {
  text-decoration: none;
  font-weight: 700;
}
.themePicker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 10px;
}
.themePickerGroup {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: var(--ui-surface-soft);
}
.themePickerGroupTitle {
  margin: 0;
  color: var(--muted);
  font: 800 10px var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.themePickerOptions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 118px), 1fr));
  gap: 7px;
}
.themePicker .themeOption {
  width: 100%;
  justify-content: center;
  min-width: 0;
  white-space: normal;
}
.settingsToggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--txt);
  margin-top: 8px;
}
.settingsToggleStack {
  align-items: flex-start;
  flex-direction: column;
}
.settingsToggle input {
  width: 16px;
  height: 16px;
}
.supportModeSelect {
  min-width: 210px;
}

.platformFields {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 8px 12px;
  margin-bottom: 10px;
  align-items: start;
}
.platformField {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.platformField span {
  color: var(--txt);
  font-size: 11px;
  font-weight: 700;
}
.platformField .edgeLabelInput {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.platformActions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.platformAdminBox {
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: var(--ui-surface-soft);
  padding: 8px;
  margin-bottom: 8px;
}
.platformAdminBox h4 {
  margin: 0 0 6px;
  font-size: 12px;
}
.platformAdminHint {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 8px;
}
.platformAdminFields {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 8px 10px;
}
.platformFieldWide {
  grid-column: 1 / -1;
}
.platformAdminEntitlements {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border-radius: 10px;
  border: 1px solid var(--ui-border-strong);
  background: var(--ui-input-bg);
  color: var(--txt);
  padding: 8px 10px;
  box-sizing: border-box;
  font-size: 12px;
  line-height: 1.3;
  font-family: var(--mono);
  outline: none;
}
.platformAdminEntitlements:focus {
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: var(--dd-glow);
}
.platformAdminActions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.platformStatus {
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  margin-bottom: 8px;
}
.platformOutputs {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 8px;
  max-height: min(48vh, 520px);
  overflow: auto;
  padding-right: 4px;
}
.platformOutput {
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: var(--ui-surface-soft);
  padding: 8px;
}
.platformOutput h4 {
  margin: 0 0 6px;
  font-size: 12px;
}
.platformOutput pre {
  margin: 0;
  font-size: 10.5px;
  line-height: 1.35;
  color: rgba(219, 230, 255, 0.92);
  font-family: var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: min(38vh, 400px);
  overflow: auto;
}
.welcomeActions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-bottom: 8px;
}
.welcomePrimaryActions {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 10px;
  justify-content: stretch;
}
.welcomePrimaryActions .btn {
  width: 100%;
  min-height: 34px;
}
.welcomeInstallRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
}
#welcomeInstallHint {
  color: rgba(226, 236, 255, 0.9);
  font-size: 12px;
  line-height: 1.4;
}

#welcomeDlg .dlgHdr {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ui-border);
}
#welcomeDlg .ttl {
  letter-spacing: 0.2px;
}
#welcomeDlg .dlgHint {
  margin: 0 0 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--ui-border);
  background: var(--ui-surface-soft);
  font-size: 12.5px;
  line-height: 1.5;
}
#welcomeDlg .dlgHint p {
  margin: 0;
}
#welcomeDlg .dlgHint p + p {
  margin-top: 9px;
}
#welcomeDlg .welcomeActions {
  gap: 10px;
  margin: 2px 0 10px;
}
#welcomeDlg .dlgBrand {
  margin-top: 10px;
  padding-top: 10px;
}
.dlgBrandLogo {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}
.dlgBrandLogo img {
  width: min(64vw, 240px);
  height: auto;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.35));
}
.dlgBrand {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--ui-border);
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
}
.dlgBrand a {
  color: #9dc0ff;
  text-decoration: none;
}
.dlgBrand a:hover {
  text-decoration: underline;
}
.dlgVersion {
  position: absolute;
  right: 14px;
  bottom: 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2px;
}
.aboutBrandStrip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
}
.aboutBrandStrip img {
  max-height: 34px;
  width: auto;
  object-fit: contain;
}
.aboutBrandStrip .aboutDdLogo {
  max-height: 26px;
}

/* --- Markdown typography inside card bodies --- */
.node .body h1,
.node .body h2,
.node .body h3,
.node .body h4,
.node .body h5,
.node .body h6 {
  margin: 4px 0 2px;
}
.node .body p {
  margin: 4px 0;
}
.node .body ul,
.node .body ol {
  margin: 4px 0 4px 16px;
  padding: 0;
}
.node .body li {
  margin: 2px 0;
}
.nodeTextAlign {
  width: 100%;
}

.nodeTextAlign-left {
  text-align: left;
}

.nodeTextAlign-center {
  text-align: center;
}

.nodeTextAlign-right {
  text-align: right;
}
.node .body .visualTextAlign-left {
  text-align: left;
}
.node .body .visualTextAlign-center {
  text-align: center;
}
.node .body .visualTextAlign-right {
  text-align: right;
}
.node .body pre {
  background: rgba(40, 50, 80, 0.65);
  padding: 8px;
  border-radius: 6px;
  overflow: auto;
}
.node .body code {
  background: rgba(40, 50, 80, 0.65);
  padding: 2px 4px;
  border-radius: 4px;
}
.node .body a,
.nodeRichLink {
  color: var(--node-link-color);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  cursor: pointer;
}
.node .body a:hover,
.nodeRichLink:hover {
  color: var(--node-link-hover);
}
.nodeRichImageWrap {
  margin: 10px 0 4px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
}
.nodeRichImageWrap:last-child {
  margin-bottom: 0;
}
.nodeRichImageLink {
  display: inline-flex;
  max-width: none;
}

.nodeRichImageWrap.align-center {
  align-items: center;
  text-align: center;
}

.nodeRichImageWrap.align-right {
  align-items: flex-end;
  text-align: right;
}
.nodeRichImage {
  display: block;
  width: var(--node-image-width, 260px);
  max-width: none;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--ui-border);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  background: var(--ui-input-bg);
  object-fit: contain;
  cursor: pointer;
}

.nodeRichImageWrap.is-image-selected .nodeRichImage {
  outline: 2px solid rgba(88, 190, 170, 0.9);
  outline-offset: 3px;
  pointer-events: none;
}

.nodeImageResizeHandles {
  position: absolute;
  inset: -7px auto auto auto;
  width: var(--node-image-width, 260px);
  height: calc(100% + 14px);
  pointer-events: none;
  z-index: 8;
}

.nodeRichImageWrap.align-center .nodeImageResizeHandles {
  left: 50%;
  transform: translateX(-50%);
}

.nodeRichImageWrap.align-left .nodeImageResizeHandles {
  left: 0;
}

.nodeRichImageWrap.align-right .nodeImageResizeHandles {
  right: 0;
}

.nodeImageResizeHandle {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 1px solid rgba(4, 24, 28, 0.9);
  border-radius: 999px;
  background: rgba(88, 225, 205, 0.96);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
  pointer-events: auto;
  z-index: 9;
}

.nodeImageResizeHandle.handle-nw,
.nodeImageResizeHandle.handle-se {
  cursor: nwse-resize;
}

.nodeImageResizeHandle.handle-ne,
.nodeImageResizeHandle.handle-sw {
  cursor: nesw-resize;
}

.nodeImageResizeHandle.handle-n,
.nodeImageResizeHandle.handle-s {
  cursor: ns-resize;
}

.nodeImageResizeHandle.handle-e,
.nodeImageResizeHandle.handle-w {
  cursor: ew-resize;
}

.nodeImageResizeHandle.handle-nw,
.nodeImageResizeHandle.handle-w,
.nodeImageResizeHandle.handle-sw {
  left: -4px;
}

.nodeImageResizeHandle.handle-ne,
.nodeImageResizeHandle.handle-e,
.nodeImageResizeHandle.handle-se {
  right: -4px;
}

.nodeImageResizeHandle.handle-nw,
.nodeImageResizeHandle.handle-n,
.nodeImageResizeHandle.handle-ne {
  top: -4px;
}

.nodeImageResizeHandle.handle-sw,
.nodeImageResizeHandle.handle-s,
.nodeImageResizeHandle.handle-se {
  bottom: -4px;
}

.nodeImageResizeHandle.handle-n,
.nodeImageResizeHandle.handle-s {
  left: 50%;
  transform: translateX(-50%);
}

.nodeImageResizeHandle.handle-w,
.nodeImageResizeHandle.handle-e {
  top: 50%;
  transform: translateY(-50%);
}

.nodeImageAlignTools,
.nodeImageMoveTools {
  position: absolute;
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(88, 225, 205, 0.88);
  border-radius: 8px;
  background: rgba(8, 14, 24, 0.82);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.34),
    0 0 15px rgba(88, 225, 205, 0.35);
  z-index: 6;
  backdrop-filter: blur(5px);
}

.nodeImageAlignTools {
  bottom: 9px;
}

.nodeImageMoveTools {
  flex-direction: column;
}

.nodeRichImageWrap.align-left .nodeImageAlignTools {
  left: calc(var(--node-image-width, 260px) / 2);
  transform: translateX(-50%);
}

.nodeRichImageWrap.align-center .nodeImageAlignTools {
  left: 50%;
  transform: translateX(-50%);
}

.nodeRichImageWrap.align-right .nodeImageAlignTools {
  right: calc(var(--node-image-width, 260px) / 2);
  transform: translateX(50%);
}

.nodeImageAlignBtn,
.nodeImageMoveBtn {
  width: 26px;
  height: 24px;
  display: inline-grid;
  gap: 2px;
  place-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: rgba(230, 255, 250, 0.95);
  cursor: pointer;
}

.nodeImageAlignBtn:hover,
.nodeImageAlignBtn:focus-visible,
.nodeImageMoveBtn:hover,
.nodeImageMoveBtn:focus-visible {
  border-color: rgba(88, 190, 170, 0.7);
  background: rgba(88, 190, 170, 0.15);
  outline: none;
}

.nodeImageMoveBtn {
  font: 800 14px/1 var(--font);
  color: rgba(230, 255, 250, 0.96);
}

.nodeImageAlignBtn span {
  display: block;
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.nodeImageAlignBtn span:nth-child(2) {
  width: 10px;
}

.nodeImageAlignBtn.align-center span {
  margin-inline: auto;
}

.nodeImageAlignBtn.align-right span {
  margin-left: auto;
}
.nodeRichImageWrap.has-fixed-height .nodeRichImage {
  height: min(var(--node-image-height, 160px), 220px);
  object-fit: cover;
}
.nodeRichImageWrap.is-broken::after {
  content: "Image could not be loaded";
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: rgba(255, 191, 201, 0.86);
}
.nodeAccountImageWrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}
.nodeAccountImageWrap.is-loading,
.nodeAccountImageWrap.is-broken {
  min-height: 74px;
  padding: 9px 10px;
  border: 1px dashed var(--ui-border);
  border-radius: 8px;
  background: rgba(18, 24, 42, 0.34);
}
.nodeAccountImageWrap.is-loading .nodeAccountImage,
.nodeAccountImageWrap.is-broken .nodeAccountImage {
  display: none;
}
.nodeAccountImageStatus {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
  color: var(--node-muted);
}
.nodeAccountImageWrap.is-broken .nodeAccountImageStatus {
  color: rgba(255, 191, 201, 0.88);
}
.nodeAccountImageWrap.is-broken::after {
  content: none;
  display: none;
}

.app.image-target-mode .node.image-target-candidate {
  z-index: 140;
  overflow: visible;
  contain: layout;
  border-color: rgba(88, 255, 225, 1);
  outline: 4px solid rgba(88, 255, 225, 0.98);
  outline-offset: 6px;
  box-shadow:
    0 0 0 3px rgba(7, 19, 28, 0.94),
    0 0 0 10px rgba(88, 255, 225, 0.4),
    0 0 28px rgba(88, 255, 225, 1),
    0 0 70px rgba(88, 255, 225, 0.86),
    0 0 118px rgba(88, 255, 225, 0.56),
    var(--shadow);
  filter:
    drop-shadow(0 0 16px rgba(88, 255, 225, 1))
    drop-shadow(0 0 38px rgba(88, 255, 225, 0.86))
    saturate(1.22);
  cursor: pointer;
}

.app.image-target-mode .node.image-target-candidate .hdr,
.app.image-target-mode .node.image-target-candidate .body {
  cursor: pointer;
}

.app.image-target-mode .node.image-target-candidate .body {
  box-shadow:
    inset 0 0 0 2px rgba(88, 255, 225, 0.86),
    inset 0 0 22px rgba(88, 255, 225, 0.28);
}

.nodeVisualBreak {
  display: block;
  height: 1.25em;
  min-height: 14px;
}
.nodeImagePlacementActions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.resize-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  right: 2px;
  bottom: 2px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 3px;
  background: rgba(124, 192, 255, 0.35);
  cursor: nwse-resize;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}
.node.selected .resize-handle {
  opacity: 1;
  pointer-events: auto;
}

.node .body,
.editor {
  scrollbar-width: thin;
  scrollbar-color: rgba(220, 209, 255, 0.34) transparent;
}
.node .body::-webkit-scrollbar,
.editor::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.node .body::-webkit-scrollbar-track,
.editor::-webkit-scrollbar-track {
  background: transparent;
}
.node .body::-webkit-scrollbar-thumb,
.editor::-webkit-scrollbar-thumb {
  background: rgba(220, 209, 255, 0.34);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.app.theme-light .node .body,
.app.theme-light .editor {
  scrollbar-color: rgba(92, 103, 136, 0.36) transparent;
}
.app.theme-light .node .body::-webkit-scrollbar-thumb,
.app.theme-light .editor::-webkit-scrollbar-thumb {
  background: rgba(92, 103, 136, 0.36);
}

@keyframes skinDropdownIn {
  from {
    opacity: 0;
    transform: translateY(var(--skin-dropdown-y-start)) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes skinMenuPop {
  from {
    opacity: 0;
    transform: translateY(-3px) scale(var(--skin-scale-start));
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes skinContextMenuIn {
  from {
    opacity: 0;
    transform: scale(var(--skin-scale-start));
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes skinPanelIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(var(--skin-panel-scale-start));
    filter: blur(1px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    filter: blur(0);
  }
}

@keyframes skinModalIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(var(--skin-panel-scale-start));
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes skinInnerPanelIn {
  from {
    opacity: 0;
    transform: translateY(3px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* --- Accessibility and responsive behavior --- */
@media (prefers-reduced-motion: reduce) {
  .edge-endpoint {
    animation: none;
  }
  :root:is(.theme-skin1, .theme-skin2) dialog[open],
  :root:is(.theme-skin1, .theme-skin2) .menuList:not([hidden]),
  :root:is(.theme-skin1, .theme-skin2) .submenuList:not([hidden]),
  :root:is(.theme-skin1, .theme-skin2) .contextMenu:not([hidden]),
  :root:is(.theme-skin1, .theme-skin2) .helpPanel.active,
  :root:is(.theme-skin1, .theme-skin2) .settingsPanel.active,
  :root:is(.theme-skin1, .theme-skin2) .myFilesImagePreviewDlg[open] .myFilesImagePreviewFrame {
    animation: none;
  }
  :root:is(.theme-skin1, .theme-skin2) .btn,
  :root:is(.theme-skin1, .theme-skin2) .menuItem,
  :root:is(.theme-skin1, .theme-skin2) .contextMenuItem,
  :root:is(.theme-skin1, .theme-skin2) .myFilesItem,
  :root:is(.theme-skin1, .theme-skin2) .aiPanel,
  :root:is(.theme-skin1, .theme-skin2) .presentationPlannerPanel {
    transition-duration: 1ms;
  }
}

@media (max-width: 900px) {
  .topbar-sep {
    display: none;
  }
  .quickTools {
    right: 8px;
    top: auto;
    bottom: 90px;
    transform: none;
  }
  .viewTools {
    left: 8px;
    top: auto;
    bottom: 90px;
    transform: none;
  }
  .quickTools .btn {
    min-width: 64px;
  }
  .viewTools .btn {
    min-width: 64px;
  }
  .visualNodeToolbarDock {
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + var(--visual-keyboard-inset, 0px));
    max-width: calc(100% - 16px);
    padding: 6px;
  }
  .visualNodeToolbarDock .visualNodeToolbar {
    max-height: 96px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .visualNodeTool {
    min-width: 34px;
  }
  .visualNodeToolMenuPanel {
    max-width: calc(100vw - 32px);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .presentationPlannerPanel {
    top: 10px;
    right: 10px;
    bottom: 10px;
    width: min(360px, calc(100vw - 20px));
  }
  .helpLayout {
    grid-template-columns: 1fr;
  }
  .helpManual {
    grid-template-columns: 1fr;
  }
  .helpQuickList,
  .helpGrid,
  .helpGridFour,
  .helpShortcutGrid {
    grid-template-columns: 1fr;
  }
  .helpPanel,
  .settingsPanel {
    min-height: min(62vh, 620px);
    max-height: min(62vh, 620px);
  }
  .platformFields {
    grid-template-columns: 1fr;
  }
  .platformAdminFields {
    grid-template-columns: 1fr;
  }
  .platformOutputs {
    grid-template-columns: 1fr;
    max-height: min(42vh, 420px);
  }
  .subscriptionsGrid {
    grid-template-columns: 1fr;
  }
  .settingsTabs {
    gap: 6px;
  }
  .helpTabs {
    gap: 6px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .settingsTab {
    min-width: 0;
  }
  .helpTab {
    min-width: 0;
  }
  .themePicker {
    grid-template-columns: 1fr;
  }
  .helpRow {
    grid-template-columns: 104px 1fr;
  }
  .helpManual .helpRow,
  .helpShortcut {
    grid-template-columns: 1fr;
  }
  #welcomeDlg {
    width: min(620px, 94vw);
    padding: 14px 14px 12px;
  }
  #welcomeDlg .dlgHint {
    padding: 12px;
  }
  #welcomeDlg .welcomeActions {
    justify-content: stretch;
  }
  #welcomeDlg .welcomePrimaryActions {
    grid-template-columns: 1fr;
  }
  #welcomeDlg .welcomeActions .btn {
    flex: 1 1 150px;
  }
  .welcomeInstallRow {
    flex-direction: column;
    align-items: stretch;
  }
  .welcomeInstallRow .btn {
    width: 100%;
  }
  .colorPanel {
    right: 0;
    left: auto;
    top: calc(100% + 8px);
    width: min(76vw, 238px);
    max-height: min(50vh, 340px);
  }
  .presentationOverlay {
    bottom: 10px;
    grid-template-columns: 1fr;
    width: min(640px, calc(100vw - 20px));
  }
  .presentationMeta {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .presentationControls {
    justify-content: stretch;
  }
  .presentationControls .btn {
    flex: 1 1 96px;
    min-width: 0;
  }
  .presentationStatus {
    white-space: normal;
  }
  .presentationAgendaList {
    max-height: min(30vh, 220px);
  }
  .presentationAgendaStep {
    grid-template-columns: 28px minmax(0, 1fr);
  }
  .presentationAgendaType {
    grid-column: 2;
  }
  .menuList {
    right: 0;
    left: auto;
    min-width: 168px;
    max-width: min(92vw, 300px);
  }
  .submenuList {
    position: static;
    min-width: 100%;
    max-width: none;
  }
  .brandFloatingInfo {
    bottom: 4px;
    font-size: 10px;
  }
}

@media (max-width: 900px) and (orientation: portrait) {
  .quickTools {
    left: 8px;
    right: auto;
    bottom: 124px;
    top: auto;
    transform: none;
    max-height: calc(100dvh - 245px);
  }
  .viewTools {
    right: 8px;
    left: auto;
    bottom: 124px;
    top: auto;
    transform: none;
  }
  .colorPanel {
    left: calc(100% + 8px);
    right: auto;
    top: auto;
    bottom: 0;
    width: min(68vw, 248px);
    max-height: min(52dvh, 360px);
  }
  .hud {
    right: 8px;
    bottom: 8px;
  }
  .brandFloatingInfo {
    left: 8px;
    right: 112px;
    bottom: 8px;
    transform: none;
    text-align: left;
  }
}
@media (max-width: 767px) {
  .brandFloatingInfo {
    display: none;
  }
  .dlgVersion {
    display: none;
  }
}

@media (hover: none), (pointer: coarse) {
  .quickTools .btn,
  .viewTools .btn,
  .presentationControls .btn,
  .presentationPlannerActions .btn,
  .presentationPlannerStepActions .btn,
  .visualNodeTool,
  .colorSwatch,
  .contextMenuItem,
  .nodeImagePlacementActions .btn,
  .nodeImageAlignBtn,
  .nodeImageMoveBtn {
    touch-action: manipulation;
  }

  .quickTools .btn,
  .viewTools .btn {
    min-width: 72px;
    min-height: 44px;
    padding-block: 10px;
  }

  .presentationControls .btn,
  .presentationPlannerActions .btn,
  .presentationPlannerStepActions .btn {
    min-height: 44px;
    padding: 10px 12px;
  }

  .presentationPlannerStepActions {
    gap: 6px;
  }

  .contextMenuItem,
  .nodeImagePlacementActions .btn {
    min-height: 44px;
    padding: 10px 12px;
  }

  .visualNodeToolbarDock {
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + var(--visual-keyboard-inset, 0px));
    max-width: calc(100vw - 18px);
    padding: 8px;
  }

  .visualNodeToolbarDock .visualNodeToolbar {
    max-width: 100%;
    max-height: 112px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .visualNodeTool {
    min-width: 44px;
    min-height: 44px;
    padding: 10px 12px;
  }

  .visualNodeColorTool {
    min-width: 44px;
    padding-inline: 11px;
  }

  .visualColorSwatch {
    width: 18px;
    height: 18px;
  }

  .colorSwatches {
    grid-template-columns: repeat(3, minmax(44px, 1fr));
  }

  .colorSwatch {
    min-width: 44px;
    min-height: 44px;
  }

  .nodeImageAlignTools,
  .nodeImageMoveTools {
    gap: 6px;
    padding: 6px;
  }

  .nodeImageAlignBtn,
  .nodeImageMoveBtn {
    width: 44px;
    height: 44px;
  }

  .nodeImageAlignBtn span {
    width: 18px;
    height: 3px;
  }

  .nodeImageAlignBtn span:nth-child(2) {
    width: 13px;
  }

  .nodeImageResizeHandles {
    inset: -13px auto auto auto;
    height: calc(100% + 26px);
  }

  .nodeImageResizeHandle {
    width: 18px;
    height: 18px;
    touch-action: none;
  }

  .nodeImageResizeHandle.handle-nw,
  .nodeImageResizeHandle.handle-w,
  .nodeImageResizeHandle.handle-sw {
    left: -9px;
  }

  .nodeImageResizeHandle.handle-ne,
  .nodeImageResizeHandle.handle-e,
  .nodeImageResizeHandle.handle-se {
    right: -9px;
  }

  .nodeImageResizeHandle.handle-nw,
  .nodeImageResizeHandle.handle-n,
  .nodeImageResizeHandle.handle-ne {
    top: -9px;
  }

  .nodeImageResizeHandle.handle-sw,
  .nodeImageResizeHandle.handle-s,
  .nodeImageResizeHandle.handle-se {
    bottom: -9px;
  }

  .resize-handle {
    width: 34px;
    height: 34px;
    right: -8px;
    bottom: -8px;
    border-radius: 6px;
    touch-action: none;
  }
}

@media (hover: none) and (max-width: 760px), (pointer: coarse) and (max-width: 760px) {
  .visualNodeToolbarDock {
    top: max(10px, env(safe-area-inset-top));
    bottom: auto;
    width: calc(100% - 16px);
    max-width: none;
    padding: 8px;
    overflow: visible;
  }

  .visualNodeToolbarDock .visualNodeToolbar {
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    max-height: none;
    overflow: visible;
  }

  .visualNodeToolMenu {
    position: relative;
  }

  .visualNodeToolMenuPanel {
    top: calc(100% + 8px);
    bottom: auto;
    max-width: calc(100vw - 24px);
    overflow: visible;
    z-index: 96;
  }

  .visualNodeHeaderMenu .visualNodeToolMenuPanel,
  .visualNodeAlignMenu .visualNodeToolMenuPanel {
    min-width: max-content;
  }

  .visualNodeListMenu .visualNodeToolMenuPanel {
    min-width: min(238px, calc(100vw - 24px));
    flex-wrap: wrap;
    white-space: normal;
  }

  .visual-viewport-unavailable .visualNodeToolbarDock {
    top: max(10px, env(safe-area-inset-top));
    bottom: auto;
  }

  .visual-keyboard-open.visual-keyboard-compact .visualNodeToolbarDock,
  .visual-viewport-unavailable .visualNodeToolbarDock {
    max-height: none;
  }
}
