/* ==========================================================================
   TopoDrawer V6 — Apple Liquid Glass (iPhone iOS 26 Laser Specular Edition)
   - High-precision GPU optical refraction + G2 superellipse SDF maps
   - Razor-sharp pure-white specular laser bevels & orbiting glint
   - Apple HIG Regular vs. Clear glass separation + icon-consistent toolbar
   - Automatic prefers-reduced-transparency & prefers-contrast accessibility
   ========================================================================== */

:root {
  --spring: cubic-bezier(0.22, 1.22, 0.36, 1);
  --ease-fluid: cubic-bezier(0.22, 1, 0.36, 1);
  --lg-blur: 1.2px;
  --lg-sat: 155%;
  --lg-radius: 28px;
  --lg-inner-radius: 16px;
  --lg-specular: 0.92;
  --lg-laser-alpha: 0.92;
  --pad-sheet: 14px;
  --el-tx: 0px;
  --el-ty: 0px;
  --el-sx: 1;
  --el-sy: 1;
  --laser-ang: 125deg;
}

.lg-svg-registry {
  position: fixed;
  width: 0;
  height: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: -1;
}

/* ==========================================================================
   PALETTE 1 (DEFAULT): OBSIDIAN PRISM — Pure Pitch Black + Laser White Glass
   ========================================================================== */
[data-palette="obsidian"] {
  /* OLED true black: pure #000 so the iPhone's OLED pixels turn fully off
     in the background — infinite contrast, like the iOS chrome. The old
     #020305 still lit the pixels a touch and washed the blacks out. */
  --bg-base: #000000;
  --layer-a: radial-gradient(ellipse 64% 50% at 84% 16%, rgba(255, 255, 255, 0.065), transparent 65%);
  --layer-b: radial-gradient(ellipse 52% 48% at 14% 88%, rgba(56, 217, 255, 0.055), transparent 68%);
  --layer-c: radial-gradient(ellipse 46% 36% at 68% 76%, rgba(255, 168, 76, 0.045), transparent 70%);

  /* Clear Liquid Glass: deeper, more opaque black so the pills read as
     sharp solid black glass on the true-black base instead of a washed
     translucent grey — crisper rim, more pop on OLED. */
  --glass-bg: linear-gradient(155deg, rgba(255, 255, 255, 0.16), rgba(8, 9, 12, 0.55) 40%, rgba(0, 0, 0, 0.72));
  /* Regular Liquid Glass (dense reading sheets/menus): higher contrast & legibility */
  --glass-bg-regular: linear-gradient(160deg, rgba(255, 255, 255, 0.14), rgba(8, 9, 12, 0.78) 34%, rgba(0, 0, 0, 0.88));
  --glass-hover: rgba(255, 255, 255, 0.13);
  --glass-active: rgba(255, 255, 255, 0.22);
  --glass-border: rgba(255, 255, 255, 0.38);
  --glass-spec-top: rgba(255, 255, 255, 0.94);
  --glass-spec-left: rgba(255, 255, 255, 0.42);
  --glass-spec-bottom: rgba(255, 255, 255, 0.22);
  --glass-shadow: 0 24px 62px rgba(0, 0, 0, 0.78), 0 2px 12px rgba(0, 0, 0, 0.56), 0 0 1px rgba(255, 255, 255, 0.45);
  --glass-lens: rgba(255, 255, 255, 0.28);

  --prism-rim: linear-gradient(
    var(--laser-ang, 125deg),
    rgba(255, 255, 255, 0.98) 0%,
    rgba(255, 255, 255, 0.92) 8%,
    rgba(88, 224, 255, 0.66) 24%,
    rgba(255, 255, 255, 0.18) 48%,
    rgba(255, 178, 88, 0.58) 72%,
    rgba(255, 86, 172, 0.46) 85%,
    rgba(255, 255, 255, 0.88) 100%
  );
  --droplet-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.32) 0%, rgba(255, 255, 255, 0.05) 48%, rgba(255, 255, 255, 0.16) 100%);
  --droplet-caustic:
    inset 0 1.6px 0.8px rgba(255, 255, 255, 0.96),
    inset 0 -2px 5px rgba(88, 224, 255, 0.50),
    inset -2px -1px 4px rgba(255, 166, 76, 0.44),
    0 6px 20px rgba(0, 0, 0, 0.48),
    0 0 10px rgba(255, 255, 255, 0.14);

  --text-primary: #ffffff;
  --text-secondary: rgba(226, 230, 240, 0.92);
  --text-muted: rgba(178, 184, 198, 0.84);
  --menubar-shadow: 0 1px 6px rgba(0, 0, 0, 0.90);

  --accent: #ffffff;
  --accent-btn-bg: linear-gradient(180deg, #ffffff, rgba(232, 236, 244, 0.94));
  --accent-btn-fg: #07080a;
  --accent-glow: rgba(255, 255, 255, 0.34);
  --danger: #ff453a;

  --squircle-bg: #000000;
  --squircle-border: rgba(255, 255, 255, 0.38);
  --input-bg: rgba(7, 8, 12, 0.62);
  --sep-color: rgba(255, 255, 255, 0.18);
  --kbd-bg: rgba(255, 255, 255, 0.10);
  --kbd-border: rgba(255, 255, 255, 0.22);
  --scroll-thumb: rgba(255, 255, 255, 0.26);
  --scroll-thumb-hover: rgba(255, 255, 255, 0.48);
}

/* ==========================================================================
   PALETTE 2: PEARL GLASS — iPhone iOS 26 Silver Frosted Pill + Rainbow Rim
   ========================================================================== */
[data-palette="pearl"] {
  --bg-base: #060709;
  --layer-a: radial-gradient(ellipse 56% 52% at 50% 44%, rgba(255, 255, 255, 0.10), transparent 64%);
  --layer-b: radial-gradient(ellipse 42% 38% at 32% 62%, rgba(92, 210, 255, 0.12), transparent 66%);
  --layer-c: radial-gradient(ellipse 40% 34% at 68% 40%, rgba(255, 168, 92, 0.12), transparent 66%);

  --glass-bg: linear-gradient(170deg, rgba(255, 255, 255, 0.78), rgba(238, 241, 247, 0.60) 55%, rgba(225, 232, 244, 0.68));
  --glass-bg-regular: linear-gradient(165deg, rgba(255, 255, 255, 0.88), rgba(240, 243, 249, 0.78));
  --glass-hover: rgba(10, 12, 18, 0.08);
  --glass-active: rgba(10, 12, 18, 0.14);
  --glass-border: rgba(255, 255, 255, 0.96);
  --glass-spec-top: rgba(255, 255, 255, 1);
  --glass-spec-left: rgba(255, 255, 255, 0.92);
  --glass-spec-bottom: rgba(88, 200, 255, 0.48);
  --glass-shadow: 0 22px 58px rgba(0, 0, 0, 0.64), 0 0 26px rgba(255, 255, 255, 0.14);
  --glass-lens: rgba(255, 255, 255, 0.88);

  --prism-rim: linear-gradient(
    var(--laser-ang, 115deg),
    rgba(255, 255, 255, 1) 0%,
    rgba(80, 216, 255, 0.82) 25%,
    rgba(255, 164, 92, 0.74) 58%,
    rgba(255, 108, 186, 0.60) 78%,
    rgba(255, 255, 255, 1) 100%
  );
  --droplet-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.28) 52%, rgba(220, 238, 255, 0.48) 100%);
  --droplet-caustic:
    inset 0 2px 1.5px rgba(255, 255, 255, 1),
    inset 0 -3px 6px rgba(68, 198, 255, 0.56),
    inset 3px -2px 6px rgba(255, 152, 76, 0.50),
    0 8px 22px rgba(0, 0, 0, 0.22);

  --text-primary: rgba(12, 14, 20, 0.96);
  --text-secondary: rgba(34, 40, 54, 0.84);
  --text-muted: rgba(66, 74, 94, 0.78);
  --menubar-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);

  --accent: #007aff;
  --accent-btn-bg: linear-gradient(180deg, #1b88ff, #006be6);
  --accent-btn-fg: #ffffff;
  --accent-glow: rgba(0, 122, 255, 0.38);
  --danger: #e53935;

  --squircle-bg: #101218;
  --squircle-border: rgba(255, 255, 255, 0.34);
  --input-bg: rgba(255, 255, 255, 0.74);
  --sep-color: rgba(14, 18, 28, 0.16);
  --kbd-bg: rgba(14, 18, 28, 0.08);
  --kbd-border: rgba(14, 18, 28, 0.18);
  --scroll-thumb: rgba(20, 26, 40, 0.24);
  --scroll-thumb-hover: rgba(20, 26, 40, 0.44);
}

[data-palette="pearl"] .transparent-menubar .menubar-item,
[data-palette="pearl"] .transparent-menubar .menubar-stat {
  color: rgba(246, 248, 252, 0.95);
}

/* ==========================================================================
   PALETTE 3: AQUA CRYSTAL
   ========================================================================== */
[data-palette="aqua"] {
  --bg-base: #020c0e;
  --layer-a: radial-gradient(ellipse 68% 58% at 18% 14%, rgba(16, 185, 168, 0.30), transparent 64%);
  --layer-b: radial-gradient(ellipse 62% 54% at 86% 26%, rgba(14, 165, 212, 0.26), transparent 66%);
  --layer-c: radial-gradient(ellipse 58% 50% at 48% 92%, rgba(34, 197, 148, 0.24), transparent 68%);

  --glass-bg: linear-gradient(155deg, rgba(180, 255, 244, 0.16), rgba(4, 30, 34, 0.32) 44%, rgba(2, 20, 24, 0.44));
  --glass-bg-regular: linear-gradient(160deg, rgba(180, 255, 244, 0.14), rgba(4, 26, 30, 0.66) 38%, rgba(2, 16, 20, 0.80));
  --glass-hover: rgba(110, 245, 226, 0.15);
  --glass-active: rgba(110, 245, 226, 0.26);
  --glass-border: rgba(148, 250, 236, 0.34);
  --glass-spec-top: rgba(240, 255, 252, 0.92);
  --glass-spec-left: rgba(128, 248, 232, 0.40);
  --glass-spec-bottom: rgba(34, 211, 238, 0.32);
  --glass-shadow: 0 22px 58px rgba(0, 10, 12, 0.72), 0 0 30px rgba(20, 184, 166, 0.16);
  --glass-lens: rgba(190, 255, 246, 0.30);

  --prism-rim: linear-gradient(var(--laser-ang, 130deg), rgba(255, 255, 255, 0.96) 0%, rgba(56, 232, 210, 0.66) 30%, rgba(56, 189, 248, 0.50) 65%, rgba(220, 255, 248, 0.78) 100%);
  --droplet-bg: linear-gradient(180deg, rgba(200, 255, 248, 0.32), rgba(20, 184, 166, 0.12) 55%, rgba(56, 189, 248, 0.20));
  --droplet-caustic: inset 0 1.6px 1px rgba(255, 255, 255, 0.95), inset 0 -2px 5px rgba(45, 212, 191, 0.56), 0 6px 18px rgba(0, 18, 22, 0.45);

  --text-primary: rgba(248, 255, 254, 0.98);
  --text-secondary: rgba(194, 238, 232, 0.86);
  --text-muted: rgba(140, 190, 186, 0.76);
  --menubar-shadow: 0 1px 6px rgba(0, 12, 14, 0.88);

  --accent: #2dd4bf;
  --accent-btn-bg: linear-gradient(180deg, #7efce8, #14b8a6);
  --accent-btn-fg: #022024;
  --accent-glow: rgba(45, 212, 191, 0.48);
  --danger: #ff5c5c;

  --squircle-bg: #04191d;
  --squircle-border: rgba(140, 246, 232, 0.34);
  --input-bg: rgba(3, 18, 22, 0.62);
  --sep-color: rgba(132, 244, 228, 0.20);
  --kbd-bg: rgba(132, 244, 228, 0.13);
  --kbd-border: rgba(132, 244, 228, 0.28);
  --scroll-thumb: rgba(110, 245, 226, 0.28);
  --scroll-thumb-hover: rgba(110, 245, 226, 0.50);
}

/* ==========================================================================
   PALETTE 4: GOLDEN WATER
   ========================================================================== */
[data-palette="golden"] {
  --bg-base: #07090e;
  --layer-a: radial-gradient(ellipse 64% 48% at 52% 10%, rgba(255, 212, 148, 0.20), transparent 64%);
  --layer-b: radial-gradient(ellipse 58% 46% at 80% 54%, rgba(212, 148, 86, 0.16), transparent 68%);
  --layer-c: radial-gradient(ellipse 68% 46% at 32% 92%, rgba(46, 98, 142, 0.28), transparent 68%);

  --glass-bg: linear-gradient(155deg, rgba(255, 242, 216, 0.16), rgba(18, 22, 30, 0.32) 44%, rgba(10, 14, 20, 0.46));
  --glass-bg-regular: linear-gradient(160deg, rgba(255, 242, 216, 0.14), rgba(14, 18, 26, 0.66) 38%, rgba(9, 12, 18, 0.80));
  --glass-hover: rgba(255, 222, 168, 0.14);
  --glass-active: rgba(255, 222, 168, 0.24);
  --glass-border: rgba(255, 232, 188, 0.32);
  --glass-spec-top: rgba(255, 252, 242, 0.94);
  --glass-spec-left: rgba(255, 230, 184, 0.38);
  --glass-spec-bottom: rgba(114, 178, 220, 0.30);
  --glass-shadow: 0 22px 58px rgba(0, 0, 0, 0.74), 0 0 28px rgba(255, 200, 120, 0.12);
  --glass-lens: rgba(255, 242, 206, 0.30);

  --prism-rim: linear-gradient(var(--laser-ang, 130deg), rgba(255, 255, 255, 0.96) 0%, rgba(255, 208, 132, 0.62) 34%, rgba(116, 186, 228, 0.48) 72%, rgba(255, 244, 216, 0.74) 100%);
  --droplet-bg: linear-gradient(180deg, rgba(255, 246, 224, 0.30), rgba(255, 204, 128, 0.10) 55%, rgba(112, 178, 224, 0.18));
  --droplet-caustic: inset 0 1.6px 1px rgba(255, 255, 246, 0.95), inset 0 -2px 5px rgba(255, 196, 112, 0.50), inset 2px -1px 4px rgba(108, 182, 230, 0.40), 0 6px 18px rgba(0, 0, 0, 0.48);

  --text-primary: rgba(255, 251, 244, 0.98);
  --text-secondary: rgba(230, 222, 208, 0.86);
  --text-muted: rgba(178, 172, 164, 0.76);
  --menubar-shadow: 0 1px 6px rgba(0, 0, 0, 0.88);

  --accent: #f6c478;
  --accent-btn-bg: linear-gradient(180deg, #ffe6b8, #e5a952);
  --accent-btn-fg: #181108;
  --accent-glow: rgba(246, 196, 120, 0.44);
  --danger: #ff5c57;

  --squircle-bg: #0f1218;
  --squircle-border: rgba(255, 230, 184, 0.30);
  --input-bg: rgba(10, 12, 17, 0.64);
  --sep-color: rgba(255, 226, 178, 0.19);
  --kbd-bg: rgba(255, 226, 178, 0.12);
  --kbd-border: rgba(255, 226, 178, 0.25);
  --scroll-thumb: rgba(255, 226, 178, 0.26);
  --scroll-thumb-hover: rgba(255, 226, 178, 0.48);
}

/* ==========================================================================
   PALETTE 5: LAVENDER iOS 26
   ========================================================================== */
[data-palette="lavender"] {
  --bg-base: #221638;
  --layer-a: radial-gradient(ellipse 74% 66% at 18% 12%, rgba(232, 206, 255, 0.50), transparent 62%);
  --layer-b: radial-gradient(ellipse 68% 64% at 82% 84%, rgba(196, 84, 255, 0.60), transparent 64%);
  --layer-c: radial-gradient(ellipse 62% 58% at 46% 52%, rgba(138, 92, 246, 0.52), transparent 68%);

  --glass-bg: linear-gradient(160deg, rgba(255, 255, 255, 0.24), rgba(18, 14, 28, 0.34) 44%, rgba(10, 8, 16, 0.48));
  --glass-bg-regular: linear-gradient(160deg, rgba(16, 16, 20, 0.78), rgba(10, 10, 14, 0.88));
  --glass-hover: rgba(255, 255, 255, 0.16);
  --glass-active: rgba(255, 255, 255, 0.26);
  --glass-border: rgba(255, 255, 255, 0.34);
  --glass-spec-top: rgba(255, 255, 255, 0.94);
  --glass-spec-left: rgba(255, 255, 255, 0.42);
  --glass-spec-bottom: rgba(220, 150, 255, 0.34);
  --glass-shadow: 0 20px 54px rgba(18, 6, 38, 0.52), 0 3px 12px rgba(18, 6, 38, 0.32);
  --glass-lens: rgba(255, 255, 255, 0.32);

  --prism-rim: linear-gradient(var(--laser-ang, 130deg), rgba(255, 255, 255, 0.96) 0%, rgba(226, 178, 255, 0.62) 38%, rgba(130, 205, 255, 0.48) 72%, rgba(255, 255, 255, 0.80) 100%);
  --droplet-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.40), rgba(255, 255, 255, 0.10) 55%, rgba(220, 175, 255, 0.24));
  --droplet-caustic: inset 0 1.6px 1px rgba(255, 255, 255, 0.96), inset 0 -2px 5px rgba(210, 148, 255, 0.52), 0 6px 18px rgba(18, 6, 38, 0.38);

  --text-primary: rgba(255, 255, 255, 0.98);
  --text-secondary: rgba(238, 230, 252, 0.88);
  --text-muted: rgba(198, 186, 220, 0.78);
  --menubar-shadow: 0 1px 6px rgba(24, 8, 48, 0.68);

  --accent: #d896ff;
  --accent-btn-bg: linear-gradient(180deg, #ffffff, #efe6ff);
  --accent-btn-fg: #140c24;
  --accent-glow: rgba(216, 150, 255, 0.48);
  --danger: #ff453a;

  --squircle-bg: #0c0d10;
  --squircle-border: rgba(255, 255, 255, 0.28);
  --input-bg: rgba(10, 10, 14, 0.68);
  --sep-color: rgba(255, 255, 255, 0.22);
  --kbd-bg: rgba(255, 255, 255, 0.14);
  --kbd-border: rgba(255, 255, 255, 0.28);
  --scroll-thumb: rgba(255, 255, 255, 0.30);
  --scroll-thumb-hover: rgba(255, 255, 255, 0.52);
}

.lg-over-light .liquid-glass {
  background: linear-gradient(160deg, rgba(16, 18, 24, 0.56), rgba(8, 10, 14, 0.78)) !important;
  color: rgba(252, 253, 255, 0.98);
}

/* ==========================================================================
   BASE & AMBIENT BACKDROP
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  /* iOS: without these, a long-press drag (e.g. arming the marquee) fires
     Safari's native text selection and the whole page turns blue. */
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* Text that must stay selectable/editable (inputs, console output). */
input, textarea, [contenteditable],
.equip-code-box, .cli-ln-txt {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  font-size: 13px;
  transition: background 380ms ease;
}

.mono { font-family: "SF Mono", "Cascadia Mono", "Consolas", monospace; }
.hidden { display: none !important; }

.ambient-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.ambient-layer { position: absolute; inset: -8%; transition: background 520ms ease; }
.layer-a { background: var(--layer-a); }
.layer-b { background: var(--layer-b); }
.layer-c { background: var(--layer-c); }

#topo-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 1;
  touch-action: none;
}

/* Drag & Drop Screenshot Glass Overlay */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 4, 8, 0.54);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.drop-card {
  padding: 26px 36px;
  border-radius: 30px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drop-title { font-size: 17px; font-weight: 720; color: #ffffff; letter-spacing: -0.015em; }
.drop-sub { font-size: 12.5px; color: var(--text-secondary); }

/* ==========================================================================
   V6 LASER-SHARP APPLE LIQUID GLASS MATERIAL (Clear vs. Regular HIG Split)
   ========================================================================== */
.liquid-glass {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-sat));
  -webkit-backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-sat));
  border: 1px solid var(--glass-border);
  box-shadow:
    inset 0 1.2px 0.6px var(--glass-spec-top),
    inset 1px 0 0.6px var(--glass-spec-left),
    inset 0 -1px 0.8px var(--glass-spec-bottom),
    var(--glass-shadow);
  transform: translate3d(var(--el-tx, 0px), var(--el-ty, 0px), 0) scale(var(--el-sx, 1), var(--el-sy, 1));
  will-change: transform, backdrop-filter;
  transition:
    background 220ms var(--ease-fluid),
    border-color 220ms var(--ease-fluid),
    box-shadow 220ms var(--ease-fluid),
    transform 250ms var(--spring),
    opacity 180ms ease;
}

/* Apple HIG Regular Liquid Glass for dense reading sheets & menus */
.liquid-glass.glass-regular {
  background: var(--glass-bg-regular);
}

/* Razor-sharp iPhone cursor-reactive specular sheen layer */
.liquid-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(210px circle at var(--mx, 50%) var(--my, 0%), var(--glass-lens), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0.04) 24%, transparent 40%);
  opacity: var(--lg-laser-alpha, 0.92);
  transition: opacity 180ms ease;
}

.liquid-glass:hover::before { opacity: 1; }

/* Laser-etched orbiting chromatic prism bevel rim */
.liquid-glass::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  border: 1.25px solid transparent;
  background: var(--prism-rim) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: var(--lg-laser-alpha, 0.92);
}

/* Gliding Convex Liquid Glass Droplet Lens */
.liquid-droplet-lens {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: 84px;
  border-radius: 999px;
  background: var(--droplet-bg);
  backdrop-filter: blur(4px) saturate(200%) brightness(1.14);
  -webkit-backdrop-filter: blur(4px) saturate(200%) brightness(1.14);
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow: var(--droplet-caustic);
  pointer-events: none;
  z-index: 0;
  transition: transform 300ms var(--spring), width 300ms var(--spring), opacity 180ms ease;
  will-change: transform, width;
}

.liquid-droplet-lens::after {
  content: "";
  position: absolute;
  inset: 1px 10% 56% 10%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.dock-lens { top: 5px; bottom: 5px; border-radius: 22px; }

/* ==========================================================================
   TRANSPARENT TOP MENU BAR
   ========================================================================== */
.transparent-menubar {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  right: 0;
  height: 32px;
  z-index: 30;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  pointer-events: none;
}

.menubar-left,
.menubar-right { display: flex; align-items: center; gap: 2px; pointer-events: auto; }

.menubar-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  text-shadow: var(--menubar-shadow);
  font-size: 12.5px;
  font-weight: 560;
  padding: 4px 9px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 140ms ease;
}

.menubar-item:hover { background: rgba(255, 255, 255, 0.13); backdrop-filter: blur(10px); }
.menubar-brand { font-weight: 720; letter-spacing: -0.015em; text-decoration: none; touch-action: manipulation; }
@media (pointer: coarse) {
  a.menubar-brand { min-height: 44px; }
}

.version-tag {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.34);
  color: #ffffff;
}

.brand-prism {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: conic-gradient(from 40deg, #ffffff, #58e0ff, #ffb258, #ff56ac, #ffffff);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.78);
}

.palette-gem { width: 9px; height: 9px; border-radius: 50%; background: var(--prism-rim); border: 1px solid rgba(255, 255, 255, 0.82); }

.menubar-stat { font-size: 11.5px; color: var(--text-secondary); text-shadow: var(--menubar-shadow); padding: 0 8px; }
.menubar-fps { font-size: 10.5px; padding: 2px 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.22); color: rgba(248, 250, 255, 0.92); margin-left: 4px; }

/* ==========================================================================
   FLOATING COMMAND ROW
   ========================================================================== */
.floating-nav {
  position: fixed;
  top: 38px;
  left: 14px;
  right: 14px;
  z-index: 22;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
  transition: transform 280ms var(--ease-fluid), opacity 220ms ease;
}

.floating-nav > * { pointer-events: auto; }
body.navigating .floating-nav .morph-pill { opacity: 0.76; }

.glass-pill { border-radius: 999px; padding: 4px; display: inline-flex; align-items: center; gap: 4px; }
.segmented-control { position: relative; padding: 4px; gap: 2px; }

.seg-btn {
  position: relative;
  z-index: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 160ms ease, transform 180ms var(--spring);
}

.seg-btn:hover, .seg-btn.active { color: var(--text-primary); }
.seg-btn.active { transform: scale(1.03); }

.morph-pill, .utility-bar { padding: 4px 7px; min-height: 36px; }

.morph-group { display: inline-flex; align-items: center; gap: 4px; animation: morphIn 200ms var(--spring); white-space: nowrap; }
@keyframes morphIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

.morph-badge { font-size: 11px; font-weight: 700; color: var(--text-primary); padding: 3px 9px; border-radius: 999px; background: var(--glass-active); border: 1px solid var(--glass-border); }

.pill-btn, .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 560;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 140ms var(--spring);
}

.sq-icon { width: 29px; height: 28px; padding: 0; }
.ui-svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.pill-btn:hover, .icon-btn:hover { background: var(--glass-hover); color: var(--text-primary); }
.pill-btn:active, .icon-btn:active { transform: scale(0.93); }

.pill-btn.active, .icon-btn.active {
  background: var(--accent-btn-bg);
  color: var(--accent-btn-fg);
  border-color: rgba(255, 255, 255, 0.65);
  box-shadow: 0 4px 18px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.90);
}

.icon-btn.active-subtle { background: var(--glass-active); color: var(--text-primary); }
.danger-btn { color: var(--danger); }
.danger-btn:hover { background: rgba(255, 69, 58, 0.26); color: #ffffff; }

.pill-sep { width: 1px; height: 15px; background: var(--sep-color); margin: 0 2px; }
.pip { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.pip.white   { background: #ffffff; box-shadow: 0 0 9px rgba(255, 255, 255, 0.90); }
.pip.cyan    { background: #58e0ff; box-shadow: 0 0 9px rgba(88, 224, 255, 0.88); }
.pip.emerald { background: #34e07c; box-shadow: 0 0 9px rgba(52, 224, 124, 0.88); }
.pip.gold    { background: #ffd066; box-shadow: 0 0 9px rgba(255, 208, 102, 0.88); }

.inline-chips { display: inline-flex; align-items: center; gap: 3px; }
.mini-seg { display: inline-flex; background: rgba(0, 0, 0, 0.22); border-radius: 999px; padding: 2px; gap: 2px; }
[data-palette="pearl"] .mini-seg { background: rgba(14, 18, 28, 0.08); }
.mini-seg-btn { border: none; background: transparent; color: var(--text-secondary); font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.mini-seg-btn.active { background: var(--accent-btn-bg); color: var(--accent-btn-fg); }

.width-control { display: inline-flex; align-items: center; gap: 6px; padding: 0 4px; }
.micro-label { font-size: 11px; color: var(--text-muted); }
.micro-val { font-size: 11px; width: 18px; text-align: right; color: var(--text-primary); }
#draw-width-slider { width: 64px; accent-color: var(--accent); cursor: pointer; }
.swatch-row { display: inline-flex; align-items: center; gap: 5px; padding: 0 3px; }
.swatch-dot { width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, 0.55); cursor: pointer; transition: transform 150ms var(--spring), box-shadow 150ms ease; }
.swatch-dot:hover { transform: scale(1.18); }
.swatch-dot.active { transform: scale(1.24); box-shadow: 0 0 0 2px #ffffff, 0 0 12px var(--accent-glow); }
.swatch-row.merge-pick-mode .swatch-dot { border-style: dashed; }
.swatch-row.merge-pick-mode .swatch-dot.active { border-style: solid; box-shadow: 0 0 0 2px #58e0ff, 0 0 14px rgba(88, 224, 255, 0.72); }
.menu-section-hint { font-size: 10px; font-weight: 600; color: var(--text-muted); padding: 2px 10px 0; letter-spacing: 0.02em; }
#draw-custom-color { width: 22px; height: 22px; border: none; background: transparent; cursor: pointer; padding: 0; }

/* ==========================================================================
   DRAGGABLE LIQUID GLASS OPTICS STUDIO
   ========================================================================== */
.optics-studio {
  position: fixed;
  top: 84px;
  right: 16px;
  width: 302px;
  max-height: calc(100vh - 104px);
  z-index: 26;
  border-radius: var(--lg-radius);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.studio-scroll {
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow-y: auto;
  padding-right: 2px;
}

.drag-handle { cursor: grab; flex-shrink: 0; }
.drag-handle:active { cursor: grabbing; }
.drag-title-wrap { display: inline-flex; align-items: center; gap: 6px; }
.drag-grip { font-size: 13px; letter-spacing: -2px; color: var(--text-muted); }

.laser-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1.5px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.44);
  color: #ffffff;
}
[data-palette="pearl"] .laser-badge { color: #0066dd; border-color: rgba(0, 122, 255, 0.36); background: rgba(0, 122, 255, 0.10); }

.hud-header { display: flex; align-items: center; justify-content: space-between; }
.hud-title { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-primary); }

.hud-close {
  width: 24px; height: 24px; border-radius: 50%; border: none;
  background: var(--glass-hover); color: var(--text-secondary);
  font-size: 15px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 140ms ease, transform 140ms var(--spring);
}
.hud-close:hover { background: var(--glass-active); color: var(--text-primary); transform: scale(1.08); }

.studio-section-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.palette-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }

.palette-card {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 8px; border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--input-bg);
  color: var(--text-secondary);
  font-size: 11px; font-weight: 600; cursor: pointer;
  transition: transform 140ms var(--spring), border-color 140ms ease, color 140ms ease;
}
.palette-card:last-child { grid-column: span 2; }
.palette-card:hover { color: var(--text-primary); transform: translateY(-1px); }
.palette-card.active { color: var(--text-primary); border-color: rgba(255, 255, 255, 0.78); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.50); }

.p-swatch { width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0; border: 1px solid rgba(255, 255, 255, 0.55); }
.obsidian-sw { background: conic-gradient(from 30deg, #050608, #ffffff, #58e0ff, #ffb258, #050608); }
.pearl-sw    { background: linear-gradient(135deg, #ffffff, #dff3ff 55%, #ffd9be); }
.aqua-sw     { background: linear-gradient(135deg, #042b30, #14b8a6 55%, #7efce8); }
.golden-sw   { background: linear-gradient(135deg, #0b1624, #d99b52 58%, #fff0c8); }
.lavender-sw { background: linear-gradient(135deg, #0e0e12 45%, #c985ff 70%, #f0dbff); }

.refraction-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 3px; border-radius: 13px; background: var(--input-bg); border: 1px solid var(--glass-border); }
.ref-btn { border: none; background: transparent; color: var(--text-muted); font-size: 10.5px; font-weight: 650; padding: 5px 3px; border-radius: 10px; cursor: pointer; transition: background 140ms ease, color 140ms ease; }
.ref-btn:hover { color: var(--text-primary); }
.ref-btn.active { background: var(--accent-btn-bg); color: var(--accent-btn-fg); box-shadow: 0 2px 10px var(--accent-glow); }

.optics-sliders { display: flex; flex-direction: column; gap: 6px; }
.slider-row { display: flex; flex-direction: column; gap: 2px; }
.slider-head { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-secondary); }
.slider-row input[type="range"] { width: 100%; height: 4px; accent-color: var(--accent); cursor: pointer; }

.studio-toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 9px; border-radius: 12px; background: var(--input-bg); border: 1px solid var(--glass-border); }
.toggle-label { display: flex; flex-direction: column; font-size: 11.5px; font-weight: 600; color: var(--text-primary); cursor: pointer; }
.toggle-hint { font-size: 10px; font-weight: 400; color: var(--text-muted); }

.glass-switch {
  appearance: none;
  -webkit-appearance: none;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid var(--glass-border);
  position: relative;
  cursor: pointer;
  transition: background 180ms ease;
}

.glass-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
  transition: transform 220ms var(--spring);
}

.glass-switch:checked { background: #34e07c; }
.glass-switch:checked::after { transform: translateX(16px); }

.studio-footer-row { display: flex; align-items: center; justify-content: space-between; }
.compact-reset { padding: 4px 10px; font-size: 11px; border-color: var(--glass-border); }
.drag-tip { font-size: 10.5px; color: var(--text-muted); }

kbd { font-family: "SF Mono", "Cascadia Mono", "Consolas", monospace; font-size: 9.5px; padding: 1.5px 5px; border-radius: 5px; background: var(--kbd-bg); border: 1px solid var(--kbd-border); color: var(--text-secondary); }
.hud-footer { border-top: 1px solid var(--sep-color); padding-top: 7px; font-size: 10.5px; line-height: 1.58; color: var(--text-muted); }
.hud-footer strong { color: var(--text-secondary); font-weight: 600; }

/* ==========================================================================
   EVE-NG EXPORT SPATIAL SIDEBAR (Concentric Sheet Geometry)
   ========================================================================== */
.eve-sheet {
  position: fixed;
  top: 84px;
  right: 14px;
  bottom: 14px;
  width: 424px;
  max-width: calc(100vw - 28px);
  z-index: 18;
  border-radius: var(--lg-radius);
  padding: var(--pad-sheet);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sheet-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 2px 4px 0; }
.sheet-title { font-size: 16px; font-weight: 700; letter-spacing: -0.015em; }
.sheet-subtitle { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.sheet-actions { display: flex; gap: 8px; }

.glass-input, .glass-textarea {
  width: 100%;
  background: var(--input-bg);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  border-radius: var(--lg-inner-radius);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
  user-select: text;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.glass-input:focus, .glass-textarea:focus { border-color: rgba(255, 255, 255, 0.72); box-shadow: 0 0 0 3px var(--accent-glow); }

.prominent-glass-btn {
  background: var(--accent-btn-bg);
  color: var(--accent-btn-fg);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--lg-inner-radius);
  padding: 8px 15px;
  font-size: 12.5px;
  font-weight: 680;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 6px 22px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.90);
  transition: transform 150ms var(--spring), filter 150ms ease;
}

.prominent-glass-btn:hover { filter: brightness(1.06); }
.prominent-glass-btn:active { transform: scale(0.95); }
.prominent-glass-btn.compact { padding: 6px 13px; border-radius: 999px; }

.sheet-section { display: flex; flex-direction: column; gap: 7px; }
.table-section { flex: 1; min-height: 0; }
.section-label { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; font-weight: 650; color: var(--text-secondary); padding: 0 2px; }
.hint-text { font-weight: 400; color: var(--text-muted); }
.count-pill { font-size: 10.5px; padding: 2px 8px; border-radius: 999px; background: var(--glass-hover); color: var(--text-secondary); }

.eve-preview-canvas { width: 100%; height: 184px; border-radius: var(--lg-inner-radius); background: var(--input-bg); border: 1px solid var(--glass-border); cursor: pointer; }
.device-table-wrap { flex: 1; min-height: 0; overflow: auto; border-radius: var(--lg-inner-radius); background: var(--input-bg); border: 1px solid var(--glass-border); }
.device-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.device-table th { position: sticky; top: 0; background: var(--glass-bg-regular); backdrop-filter: blur(12px); text-align: left; padding: 8px 10px; font-weight: 650; color: var(--text-secondary); border-bottom: 1px solid var(--sep-color); }
.device-table td { padding: 7px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); color: var(--text-primary); white-space: nowrap; }
.device-table tr:hover td { background: var(--glass-hover); }
.eve-messages { font-size: 11px; line-height: 1.45; padding: 9px 11px; border-radius: var(--lg-inner-radius); background: rgba(255, 208, 102, 0.12); border: 1px solid rgba(255, 208, 102, 0.34); color: var(--text-secondary); max-height: 86px; overflow: auto; }

/* ==========================================================================
   BOTTOM FLOATING LIQUID GLASS DOCK
   ========================================================================== */
.dock-hover-zone {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  padding: 18px 26px 16px;
  z-index: 20;
  pointer-events: none;
}

.bottom-dock {
  pointer-events: auto;
  position: relative;
  padding: 6px 8px;
  gap: 3px;
  border-radius: 30px;
  transform-origin: center bottom;
}

body.navigating .bottom-dock { transform: scale(0.88) translateY(10px); opacity: 0.62; }
body.navigating .dock-hover-zone:hover .bottom-dock {
  transform: translate3d(var(--el-tx, 0px), var(--el-ty, 0px), 0) scale(var(--el-sx, 1), var(--el-sy, 1));
  opacity: 1;
}

.dock-item {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 54px;
  padding: 6px 7px 5px;
  border-radius: 22px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: transform 240ms var(--spring), color 150ms ease;
}

.dock-item:hover { transform: translateY(-4px) scale(1.07); color: var(--text-primary); }
.dock-item:active { transform: translateY(-1px) scale(0.95); }
.dock-item.active { color: var(--text-primary); }

.dock-squircle {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--squircle-bg);
  border: 1px solid var(--squircle-border);
  box-shadow: inset 0 1.2px 0.5px rgba(255, 255, 255, 0.52), 0 4px 12px rgba(0, 0, 0, 0.42);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #f6f8fc;
  transition: box-shadow 180ms ease, border-color 180ms ease;
}

.dock-svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.router-sq   { color: #58e0ff; }
.switch-sq   { color: #34e07c; }
.firewall-sq { color: #ff5b52; }
.ap-sq       { color: #c882ff; }
.host-sq     { color: #ffbe4f; }
.shot-sq     { color: #58e0ff; }
.neutral-sq  { color: #ffffff; }
.danger-sq   { color: #ff5b52; }

.dock-item.active .dock-squircle { border-color: rgba(255, 255, 255, 0.76); box-shadow: inset 0 1.2px 1px rgba(255, 255, 255, 0.80), 0 0 16px rgba(255, 255, 255, 0.24); }
.dock-label { font-size: 10px; font-weight: 600; letter-spacing: 0.01em; }
.dock-sep { width: 1px; height: 30px; background: var(--sep-color); margin: 0 3px; z-index: 1; }

/* ==========================================================================
   FLOATING MENUS (With Apple HIG Leading Icons), POPOVERS & TOAST
   ========================================================================== */
.glass-menu {
  position: fixed;
  z-index: 40;
  min-width: 228px;
  border-radius: 18px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* Liquid-glass entrance: the menu melts in over ~420ms — it blooms up
     from the press point, the glass clarifies (blur melts away) and it
     settles with a barely-there overshoot, instead of snapping on in 200ms.
     The old menuPop was too abrupt; this one flows. */
  animation: menuMelt 420ms cubic-bezier(0.22, 1, 0.36, 1);
  /* The menu is a press-and-slide surface, not a scroll view: touch drags
     on it must arrive as pointer events (so the slide highlight and the
     release-pick work), never get hijacked by the browser as a scroll —
     a scroll hijack fires pointercancel, the highlight stops tracking and
     the release does nothing, which is why picking a type (or a delete)
     by sliding sometimes didn't activate. The menus are short enough to
     fit without scrolling. */
  touch-action: none;
}

/* The melt: starts small, soft and blurred (like glass condensing), blooms
   to full clarity with a whisper of overshoot, then settles. The blur is
   the liquid part — the menu sharpens as it arrives. Kept to 4px (not 8)
   so the melt stays cheap on phones; animating a heavy blur every frame
   is what made the dock menus feel laggy. */
@keyframes menuMelt {
  0% { opacity: 0; transform: scale(0.82) translateY(10px); filter: blur(4px); }
  55% { opacity: 1; transform: scale(1.015) translateY(-1px); filter: blur(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
}

/* Liquid dismiss: the menu melts back out — fades, shrinks slightly and
   blurs — instead of vanishing in one frame. Paired with hideContextMenu's
   260ms timer, which removes it after the melt finishes. */
.glass-menu.menu-closing {
  animation: none;
  opacity: 0;
  transform: scale(0.9) translateY(6px);
  filter: blur(6px);
  transition: opacity 260ms ease, transform 260ms cubic-bezier(0.22, 1, 0.36, 1), filter 260ms ease;
}

/* Item cascade: the rows flow in one after another (a ripple down the
   menu) instead of the whole block popping at once. The stagger is short
   so the menu is fully usable by ~420ms. */
.glass-menu .menu-item { animation: menuItemIn 340ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.glass-menu .menu-item:nth-child(1) { animation-delay: 30ms; }
.glass-menu .menu-item:nth-child(2) { animation-delay: 70ms; }
.glass-menu .menu-item:nth-child(3) { animation-delay: 110ms; }
.glass-menu .menu-item:nth-child(4) { animation-delay: 150ms; }
.glass-menu .menu-item:nth-child(5) { animation-delay: 190ms; }
.glass-menu .menu-item:nth-child(n+6) { animation-delay: 220ms; }
@keyframes menuItemIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 520;
  text-align: left;
  cursor: pointer;
  /* Slower, smoother slide: the highlight glides between items (160ms,
     eased) instead of snapping (110ms), so travelling down the menu feels
     smooth, not staticky. */
  transition: background 160ms ease, color 160ms ease, transform 160ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 160ms ease;
}

.menu-item-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.menu-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.85;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu-item:hover { background: var(--accent-btn-bg); color: var(--accent-btn-fg); }
/* Press-and-slide highlight: the item under the finger while sliding through
   a long-press-opened menu (touch has no hover, so the slide tracker adds
   this class). Unmistakably sticky — the row under the finger lifts hard
   (scale + solid bright fill + a clear ring + a drop shadow) so it feels
   like you're really grabbing and holding each option as you travel down. */
.menu-item.slide-hover { background: var(--accent-btn-bg); color: var(--accent-btn-fg); transform: scale(1.08); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45), inset 0 0 0 2px rgba(255, 255, 255, 0.35); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger); color: #ffffff; }
.menu-item.danger.slide-hover { background: var(--danger); color: #ffffff; transform: scale(1.08); box-shadow: 0 4px 16px rgba(255, 91, 82, 0.5), inset 0 0 0 2px rgba(255, 255, 255, 0.35); }
.menu-sep { height: 1px; background: var(--sep-color); margin: 4px 8px; }
.menu-chip-row { display: flex; flex-wrap: wrap; gap: 5px; padding: 4px 10px 6px; }
.menu-speed-chip { border: 1px solid var(--glass-border); background: var(--glass-hover); color: var(--text-primary); font-family: "SF Mono", "Cascadia Mono", monospace; font-size: 10.5px; padding: 3px 8px; border-radius: 999px; cursor: pointer; }
.menu-speed-chip:hover, .menu-speed-chip.active { background: var(--accent-btn-bg); color: var(--accent-btn-fg); border-color: rgba(255, 255, 255, 0.55); }

.glass-popover {
  position: fixed;
  z-index: 45;
  width: 292px;
  border-radius: 22px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: menuPop 160ms var(--spring);
}

/* In-place editor: a bare input/textarea floated over the canvas text so
   annotations and packet-header fields are edited inside the box itself.
   Transparent, borderless, no chrome — the font/color are set inline by JS
   to match the text it sits on. */
.inline-editor {
  position: fixed;
  z-index: 3000;
  display: none;
  background: transparent;
  border: none;
  outline: none;
  box-shadow: none;
  resize: none;
  padding: 0;
  margin: 0;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
  /* Liquid-glass editor: soft rounded surface, a gentle lift shadow and a
     bright top rim so the editable note reads as the same glass as the
     annotation itself. */
  border-radius: 12px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  transform-origin: center center;
}
.inline-editor.visible {
  display: block;
  /* Smooth open: the editor melts in from the note instead of popping. */
  animation: inlineEditIn 190ms cubic-bezier(0.22, 1.4, 0.36, 1) both;
}
@keyframes inlineEditIn {
  from { opacity: 0; transform: scale(0.965); }
  to { opacity: 1; transform: scale(1); }
}

.glass-popover.wide-editor {
  width: min(560px, calc(100vw - 32px));
}

.glass-popover.wide-editor .glass-textarea {
  font-family: "SF Mono", "Cascadia Mono", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.5;
  min-height: 240px;
  max-height: min(56vh, 460px);
  resize: vertical;
  white-space: pre;
  overflow-x: auto;
  tab-size: 2;
}

.popover-title { font-size: 12.5px; font-weight: 700; color: var(--text-primary); }
.popover-actions { display: flex; justify-content: flex-end; gap: 6px; }

.glass-toast {
  position: fixed;
  right: 16px;
  bottom: 20px;
  z-index: 50;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  pointer-events: none;
  animation: menuPop 160ms var(--spring);
}

/* ==========================================================================
   FULLSCREEN API (F11), RESPONSIVE & APPLE HIG ACCESSIBILITY
   ========================================================================== */
html:fullscreen,
html:-webkit-full-screen,
body:fullscreen,
body:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-base);
}

.fullscreen-btn { padding: 4px 8px; font-size: 13.5px; line-height: 1; }
.fullscreen-btn.active { background: rgba(255, 255, 255, 0.18); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45); }

@media (max-width: 1360px) {
  .floating-nav { top: 36px; left: 10px; right: 10px; gap: 6px; }
  .seg-btn { font-size: 11.5px; padding: 5px 10px; }
  .pill-btn { font-size: 11.5px; padding: 4px 8px; gap: 4px; }
  .dock-item { min-width: 48px; padding: 5px 6px 4px; }
  .eve-sheet { width: 380px; }
}

/* Phones: the menubar, tab row and dock are wider than the screen, so their
   ends ran off the edges and the page felt like it slid around under your
   finger. Keep every control on-screen: hide the desktop-only chips, stack
   the tab row, and let the dock scroll inside itself. */
/* Phone sidebar toggle: hidden on desktop, shown in the ≤760px block. */
#btn-mobile-nav { display: none; }
/* Mobile menus row: hidden on desktop, shown in the ≤760px block (inside
   the ☰ drawer) so the File / Edit / View / Topology actions reach phones. */
.mobile-menus { display: none; }
/* Mobile dock buttons: hidden on desktop (the full dock row shows there).
   On phones the row collapses into two buttons — Nodes (every device type)
   and Edit (Select / Undo / Redo and the other editing actions). */
.dock-nodes-btn, .dock-edit-btn { display: none; }
/* Mobile selection bar: hidden on desktop; on phones it appears as a bottom
   action bar whenever a device is selected (see the ≤760px block). */
.mobile-selection-bar { display: none; }

@media (max-width: 760px) {
  #fps-chip, #btn-fullscreen, #btn-zoom-reset { display: none; }
  /* The hamburger (☰) is the only way into the menus on a phone, and at
     12px type + 4px padding it was a ~28px target — easy to miss with a
     thumb, and a miss lands on the canvas and starts a drag instead. Give
     it a proper 44px thumb target. */
  #btn-mobile-nav {
    min-width: 44px;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 19px;
    line-height: 1;
    justify-content: center;
  }
  /* The four text menus + version badge push the menubar past the screen
     edge on phones (badge clipped to "V7", menus unreachable). On a phone
     the tab row + dock already cover navigation; hide them here. */
  .version-tag,
  .menubar-item[data-menu="file"],
  .menubar-item[data-menu="edit"],
  .menubar-item[data-menu="view"],
  .menubar-item[data-menu="topology"] { display: none; }
  .transparent-menubar { padding: 0 8px; }
  .menubar-item { padding-inline: 6px; }
  .menubar-left { min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .menubar-left::-webkit-scrollbar { display: none; }
  .menubar-right { flex-shrink: 0; }
  /* Phone menubar: the palette name ("Obsidian Prism") + stats squeeze the
     brand until "TopoDrawer" clips. Keep just the palette gem on phones
     (it still opens the palette menu) and compact the stats. */
  .menubar-right #palette-label { display: none; }
  .menubar-stat { font-size: 10.5px; padding: 0 4px; }
  /* Phone sidebar: the floating pills stack over the canvas and cover it,
     so on phones they live in a slide-in drawer (☰ in the menubar) and the
     canvas stays clear. The drawer is near-opaque dark glass so the pills
     stay readable over the light 3D scene too. */
  #btn-mobile-nav { display: inline-flex; align-items: center; justify-content: center; font-size: 17px; line-height: 1; }
  .floating-nav {
    left: 0; right: auto; top: 48px; bottom: 0;
    width: min(300px, 84vw);
    flex-direction: column; flex-wrap: nowrap; justify-content: flex-start; align-items: stretch;
    gap: 8px; padding: 12px 10px;
    overflow-y: auto; overflow-x: hidden;
    background: rgba(8, 10, 14, 0.9);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    border-right: 1px solid var(--glass-border);
    border-radius: 0 18px 18px 0;
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.45);
    transform: translateX(-115%);
    /* Smooth drawer (his Dec 3 ask): one spring curve both ways on the
       compositor (will-change), and a cheaper blur — the panel is 90%
       opaque, so the old 8px backdrop blur bought nothing visually
       and cost a full-screen re-render on every frame of the slide. */
    transition: transform 460ms cubic-bezier(0.32, 0.72, 0.24, 1), visibility 460ms;
    will-change: transform;
    visibility: hidden;
    pointer-events: auto;
  }
  body.mobile-nav-open .floating-nav { transform: translateX(0); visibility: visible; }
  .floating-nav .morph-pill, .floating-nav .utility-bar, .floating-nav .segmented-control { width: 100%; max-width: 100%; }
  /* Only one bottom bar at a time on phones: when a device is selected the
     selection bar is the bottom bar and the device dock hides, so the two
     never overlap and garble (the "placing routers" glitch). Deselecting
     brings the dock back. */
  body.mobile-selection-active .bottom-dock { display: none; }
  /* Bottom two drawer pills REMOVED on phones (his call, Dec 2): the
     utility bar (undo / redo / open / save / snapshot) and the mobile
     menus row (File / Edit / View / Topology) no longer show in the ☰
     drawer — the drawer ends after the node controls, so it's focused
     on the selected device. (Desktop keeps both; this is phone-only.) */
  .floating-nav .utility-bar { display: none; }
  .floating-nav .mobile-menus { display: none; }
  /* Mobile selection bar: a bottom action bar that appears only while a
     device is selected (the app removes .hidden). Fixed above the bottom
     edge, thumb-reachable, same liquid glass pill. */
  .mobile-selection-bar:not(.hidden) { display: flex; position: fixed; left: 50%; transform: translateX(-50%); bottom: max(12px, env(safe-area-inset-bottom)); z-index: 60; gap: 4px; padding: 5px 6px; align-items: center; max-width: calc(100vw - 16px); overflow-x: auto; scrollbar-width: none; scroll-padding: 0 8px; animation: selBarIn 380ms cubic-bezier(0.22, 1, 0.36, 1); }
  /* The selection bar melts in like the hold menu — rises up, sharpens
     from a soft blur, settles. It used to just appear in one frame. */
  @keyframes selBarIn {
    from { opacity: 0; transform: translateX(-50%) translateY(14px) scale(0.96); filter: blur(4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); filter: blur(0); }
  }
  .mobile-selection-bar:not(.hidden)::-webkit-scrollbar { display: none; }
  /* Toast vs selection bar (his Dec 3 photo): the link hint toast and
     the selection bar both live at the bottom on phones and rendered
     on top of each other, text interleaved. While a selection is
     active the toast lifts above the bar and caps its width so long
     hints wrap inside the screen instead of running under the bar. */
  body.mobile-selection-active .glass-toast { bottom: 80px; }
  .glass-toast { max-width: calc(100vw - 32px); }
  /* De-crowded: smaller type + tighter buttons so the six items fit a phone
     width without scrolling or clipping mid-word. The separators are hidden
     here (they ate space and added visual noise); the label is just the
     device id ("R1") or the count ("3 devices"). */
  .mobile-selection-bar:not(.hidden) .pill-btn { flex: 0 0 auto; white-space: nowrap; font-size: 13px; padding: 6px 9px; }
  /* Liquid hold-press on the selection bar buttons: pressing one dents it
     in like liquid glass (squeezes + a soft inner glow + a bright rim),
     the same hold feel as the node squeeze — not the flat 0.93 scale.
     It springs back with a soft ease when you lift. */
  .mobile-selection-bar:not(.hidden) .pill-btn:active {
    transform: scale(0.90);
    background: rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 0 1.5px rgba(255, 255, 255, 0.22);
    transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), background 180ms ease, box-shadow 180ms ease;
  }
  .mobile-selection-bar:not(.hidden) .pill-sep { display: none; }
  .mobile-selection-bar:not(.hidden) #mobile-sel-label { font-size: 12.5px; padding: 4px 10px; flex: 1 1 auto; min-width: 0; max-width: 52vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* Phone drawer organization: the workspace tabs are one clean row (no
     2x2 wrap), and the X-Ray/Walk/Floors controls form a tidy 2-column
     grid instead of a jumbled wrap — the drawer reads as a menu, not a
     pile of pills. */
  .floating-nav .segmented-control { flex-wrap: nowrap; flex-direction: row; }
  .floating-nav .seg-btn { flex: 1 1 0; min-width: 0; padding: 7px 3px; font-size: 11px; color: rgba(252, 253, 255, 0.98); }
  /* Phone drawer tools: the 2-column grid was ragged — mixed control types
     (buttons, a label + select, a menu) forced into equal cells, and the
     Place label still clipped at the pill's left edge. In the drawer the
     tools are now a clean vertical list: the pill becomes a full-width
     card, each tool its own full-width row, left-aligned with room to
     breathe, like a settings list. Desktop keeps the horizontal pill. */
  .floating-nav .morph-pill, .floating-nav .utility-bar { color: rgba(252, 253, 255, 0.98); }
  .floating-nav .morph-pill {
    /* Compact on a phone: cap the width so a contextual panel (e.g. the
       link panel) doesn't stretch edge-to-edge as a tall full-width card,
       and center it. Rows hug their content. */
    max-width: min(320px, calc(100vw - 32px));
    margin-inline: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    /* Liquid, not a box: a soft fluid radius so the card reads as one
       flowing glass surface with the other capsules, and the sheen/rim
       (border-radius: inherit) follow the same curve. */
    border-radius: 26px;
    padding: 4px;
    gap: 2px;
  }
  .floating-nav .morph-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    white-space: normal;
    gap: 2px;
    width: 100%;
  }
  .floating-nav .morph-pill .pill-btn, .floating-nav .morph-pill details, .floating-nav .morph-pill .place-floor {
    /* Compact rows that hug their content: no flex-grow, so a tall drawer can
       never stretch them into big empty capsules. */
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
    padding: 5px 9px;
    font-size: 12px;
    border-radius: 14px;
    /* Each row is a liquid-glass segment, not flat text on a card: a faint
       translucent fill + hairline border so the rows read as glass tiles
       flowing down the surface. */
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10);
  }
  .floating-nav .morph-pill .pill-btn:hover, .floating-nav .morph-pill details:hover { background: rgba(255, 255, 255, 0.10); }
  .floating-nav .morph-pill .place-floor { margin-inline: 0; }
  .floating-nav .morph-pill .place-floor select { min-width: 0; margin-left: auto; }
  .floating-nav .morph-pill .pill-sep { display: none; }
  /* Stop the "navigating" give-way on phones: while dragging, the dock
     shrinks 12% + drops 10px and the toolbar pill fades — on a phone that
     reads as the whole screen jumping/shaking on every drag. The chrome
     stays put here; desktop keeps the effect. */
  /* The glass hover lenses (the bright droplet that glides over the active
     tab / dock item) crowd the small screen — the active button's own
     styling already marks the selection, so hide them on phones. */
  #workspace-thumb, #dock-lens { display: none; }
  body.navigating .bottom-dock { transform: none; opacity: 1; }
  body.navigating .floating-nav .morph-pill { opacity: 1; }
  .dock-hover-zone { padding: 10px 7px 12px; max-width: 100vw; }
  .bottom-dock {
    max-width: calc(100vw - 14px);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    touch-action: pan-x;
  }
  /* Two-button dock on phones: the whole row of tool buttons collapses into
     Nodes + Edit. Each opens its own vertical press-and-slide menu above
     the dock. The separators go too. */
  .bottom-dock .dock-item:not(.dock-nodes-btn):not(.dock-edit-btn) { display: none; }
  .bottom-dock .dock-sep { display: none; }
  .bottom-dock .dock-nodes-btn, .bottom-dock .dock-edit-btn { display: flex; }
  .bottom-dock { justify-content: center; gap: 14px; }
  .bottom-dock::-webkit-scrollbar { display: none; }
  .bottom-dock .dock-item { flex-shrink: 0; }
}

@media (prefers-reduced-transparency: reduce) {
  .liquid-glass,
  .liquid-glass.glass-regular {
    background: rgba(12, 14, 18, 0.94) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
  }
  [data-palette="pearl"] .liquid-glass,
  [data-palette="pearl"] .liquid-glass.glass-regular {
    background: rgba(246, 248, 252, 0.96) !important;
  }
}

@media (prefers-contrast: more) {
  .liquid-glass { border-color: rgba(255, 255, 255, 0.72) !important; }
  [data-palette="pearl"] .liquid-glass { border-color: rgba(10, 12, 18, 0.55) !important; }
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); }


/* ==========================================================================
   V7 ADDITIONS: DIRECT TAP-TO-RENAME PILL, TOPODRAWER-IT PILL & EQUIP INSPECTOR
   ========================================================================== */
.inline-node-rename {
  position: fixed;
  z-index: 42;
  transform: translate(-50%, -50%);
  min-width: 64px;
  max-width: 240px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(10, 12, 18, 0.94);
  color: #ffffff;
  border: 1.5px solid #58e0ff;
  box-shadow: 0 0 0 3px rgba(88, 224, 255, 0.28), 0 8px 22px rgba(0, 0, 0, 0.72);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  font-size: 11.5px;
  font-weight: 650;
  text-align: center;
  outline: none;
  user-select: text;
  caret-color: #58e0ff;
}

[data-palette="pearl"] .inline-node-rename {
  background: rgba(252, 253, 255, 0.96);
  color: #0e121a;
  border-color: #007aff;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.25), 0 8px 20px rgba(0, 0, 0, 0.28);
  caret-color: #007aff;
}

.prominent-pill-btn {
  background: linear-gradient(135deg, rgba(88, 224, 255, 0.28), rgba(52, 224, 124, 0.24));
  border-color: rgba(88, 224, 255, 0.72);
  color: #ffffff;
  font-weight: 660;
  box-shadow: 0 0 14px rgba(88, 224, 255, 0.26);
}

.prominent-pill-btn:hover {
  background: linear-gradient(135deg, rgba(88, 224, 255, 0.44), rgba(52, 224, 124, 0.36));
  color: #ffffff;
}

.equip-inspector {
  position: fixed;
  top: 84px;
  left: 16px;
  width: 332px;
  max-height: calc(100vh - 110px);
  z-index: 27;
  border-radius: var(--lg-radius);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  animation: menuPop 160ms var(--spring);
}

.equip-health-pill {
  font-size: 9.5px;
  font-weight: 750;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
}
.equip-health-pill.ok    { background: rgba(52, 224, 124, 0.20); border: 1px solid #34e07c; color: #a8ffd4; }
.equip-health-pill.warn  { background: rgba(255, 208, 102, 0.20); border: 1px solid #ffd066; color: #ffe69e; }
.equip-health-pill.error { background: rgba(255, 91, 82, 0.22); border: 1px solid #ff5b52; color: #ffb4b0; }

.equip-code-box {
  background: rgba(4, 6, 10, 0.72);
  border: 1px solid var(--glass-border);
  border-radius: 13px;
  padding: 9px 11px;
  font-size: 10.5px;
  line-height: 1.55;
  color: #8eeeff;
  overflow-x: auto;
  max-height: 180px;
  user-select: text;
  white-space: pre-wrap;
  word-break: break-word;
}

.equip-issue-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  max-height: 220px;
}

.equip-issue {
  padding: 7px 10px;
  border-radius: 12px;
  font-size: 11px;
  line-height: 1.42;
  border: 1px solid transparent;
}
.equip-issue strong { display: block; font-size: 11.5px; margin-bottom: 2px; }
.equip-issue.ok    { background: rgba(52, 224, 124, 0.12); border-color: rgba(52, 224, 124, 0.42); color: #d6ffea; }
.equip-issue.warn  { background: rgba(255, 208, 102, 0.12); border-color: rgba(255, 208, 102, 0.42); color: #fff0c4; }
.equip-issue.error { background: rgba(255, 91, 82, 0.14); border-color: rgba(255, 91, 82, 0.48); color: #ffd4d2; }


/* V7.5 Inspector: Topology Context & Line-Highlighted CLI Fault View */
.equip-scenario-box {
  background: rgba(12, 24, 34, 0.68);
  border: 1px solid rgba(88, 224, 255, 0.34);
  border-radius: 12px;
  padding: 7px 10px;
  font-size: 10px;
  line-height: 1.48;
  color: #bceeff;
  white-space: pre-wrap;
  word-break: break-word;
}

.equip-cli-box {
  background: rgba(4, 6, 10, 0.80);
  border: 1px solid var(--glass-border);
  border-radius: 13px;
  padding: 7px 6px;
  font-size: 10px;
  line-height: 1.5;
  max-height: 165px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cli-line {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 6px;
  border-radius: 6px;
  color: rgba(226, 232, 244, 0.86);
}

.cli-ln-num {
  width: 14px;
  text-align: right;
  opacity: 0.45;
  flex-shrink: 0;
}

.cli-ln-txt {
  flex: 1;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
}

.cli-line-err {
  background: rgba(255, 72, 88, 0.16);
  border-left: 2.5px solid var(--err-col, #ff5b52);
  color: #ffffff;
}

.cli-line-missing {
  background: rgba(255, 208, 102, 0.12);
  border: 1px dashed var(--err-col, #ffd066);
  color: #ffe69e;
}

.cli-err-tag {
  font-size: 8.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--err-col, #ff5b52);
  color: #ffffff;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---- Style wheel (replaces the palette list menu) ---- */
.palette-wheel-pop {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 60;
  width: 288px;
  padding: 14px 14px 12px;
  border-radius: 26px;
  text-align: center;
  animation: menuPop 240ms var(--spring, ease);
}
.palette-wheel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 0 4px 6px;
}
.palette-wheel-close {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--glass-hover);
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.palette-wheel-stage { position: relative; width: 240px; height: 240px; margin: 0 auto; }
.palette-wheel-ring { position: absolute; inset: 0; width: 240px; height: 240px; will-change: transform; pointer-events: none; }
.palette-wheel-svg { position: relative; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.palette-wheel-svg:active { cursor: grabbing; }
.palette-wheel-active-arc { fill: rgba(255, 255, 255, 0.13); stroke: rgba(255, 255, 255, 0.9); stroke-width: 2; pointer-events: none; }
.palette-wheel-marker { fill: #ffffff; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5)); pointer-events: none; }
.palette-wheel-label { font-size: 11px; font-weight: 650; fill: rgba(255, 255, 255, 0.95); paint-order: stroke; stroke: rgba(0, 0, 0, 0.38); stroke-width: 2.5px; pointer-events: none; }
.palette-wheel-hub { fill: rgba(10, 11, 14, 0.72); stroke: rgba(255, 255, 255, 0.22); stroke-width: 1; }
.palette-wheel-name { font-size: 13px; font-weight: 700; fill: #ffffff; }
.palette-wheel-hint { font-size: 10px; fill: rgba(255, 255, 255, 0.55); }
.palette-wheel-foot { font-size: 11px; color: var(--text-secondary); padding-top: 4px; }
@media (max-width: 760px) {
  .palette-wheel-pop { width: min(300px, calc(100vw - 40px)); }
}

/* ---- Dock menus (Nodes / Edit) use the same liquid cascade as every
   other menu ---- */
/* The old bubbly dockItemPop (bouncy ease-out-back overshoot) fought the
   menuMelt container animation — the rows bounced while the menu was still
   melting in, which read as laggy/staticky on phones. Dock menus now ride
   the shared menuItemIn cascade (smooth, no overshoot), so the whole menu
   flows as one piece. The dock-menu-pop class is kept as a no-op hook. */

/* ---- Boot veil (2D ⇄ 3D hop) ----
   Painted by the bare HTML before any app script runs, so switching
   modes shows a soft pulsing dot under the (always visible) menubar
   instead of a dead black canvas. The app adds .done on its first
   frame; an inline fallback timer lifts it after 4s no matter what.
   pointer-events: none — it can never block a tap. */
#bootVeil { position: fixed; inset: 0; z-index: 25; display: flex; align-items: center; justify-content: center; background: #000000; pointer-events: none; opacity: 1; transition: opacity 420ms ease; }
#bootVeil.done { opacity: 0; }
.boot-veil-dot { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #7dd3fc, #38bdf8 45%, #8b5cf6); box-shadow: 0 0 26px rgba(56, 189, 248, 0.55); animation: bootVeilPulse 1100ms ease-in-out infinite; }
@keyframes bootVeilPulse { 0%, 100% { transform: scale(0.82); opacity: 0.6; } 50% { transform: scale(1.18); opacity: 1; } }

/* ---- Node radial (hold empty canvas → pick a node type) ----
   A circle of glass buttons around the held finger. The overlay never
   takes pointer events — the canvas keeps the gesture; the radial is
   driven entirely from the canvas pointer handlers. */
.node-radial { position: fixed; width: 248px; height: 248px; z-index: 55; pointer-events: none; animation: menuPop 200ms var(--spring, ease); }
.node-radial-btn { position: absolute; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; background: rgba(16, 19, 26, 0.72); border: 1px solid rgba(255, 255, 255, 0.22); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); color: rgba(255, 255, 255, 0.85); transition: transform 120ms ease, background 120ms ease, border-color 120ms ease; }
.node-radial-btn span { font-size: 8.5px; font-weight: 650; letter-spacing: 0.02em; }
.node-radial-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.node-radial-btn.is-active { background: rgba(56, 189, 248, 0.28); border-color: rgba(125, 211, 252, 0.9); color: #ffffff; transform: scale(1.14); }
.node-radial-btn.danger { color: #fda4a4; border-color: rgba(248, 113, 113, 0.45); }
.node-radial-btn.danger.is-active { background: rgba(220, 38, 38, 0.30); border-color: rgba(248, 113, 113, 0.95); color: #ffffff; }
.node-radial.clickable { pointer-events: auto; }
.node-radial.clickable .node-radial-btn { pointer-events: auto; cursor: pointer; }
.node-radial-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 12.5px; font-weight: 700; color: #ffffff; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); white-space: nowrap; }
