/* ==========================================================================
   TopoDrawer 3D — Apple Liquid Glass Supplement (Inherits ../liquid_glass.css)
   Zero overlapping menus · Crisp translucent panels · Clean 3D HUD
   ========================================================================== */

#viewport {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  cursor: grab;
}
#viewport:active { cursor: grabbing; }
body.tool-place #viewport { cursor: crosshair; }

#labels-layer {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.walk-banner {
  position: fixed;
  top: 86px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 32;
  padding: 7px 16px;
  font-size: 12px;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.walk-trace-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  letter-spacing: 0.01em;
  color: #ffe9a8;
  white-space: nowrap;
}
.device-menu-actions { display: flex; gap: 8px; margin-top: 10px; }
.device-menu-delete { color: #ff8a8a !important; }

/* The banner itself is pointer-events: none so it never blocks drag-to-look
   on the canvas — but the Exit Walk button inside it must still be tappable,
   or there is no touch way out of Walk mode. Re-enable events on the button. */
#walkExitBtn { pointer-events: auto; }

/* Glass UI toggle: when the UI is hidden, all the floating glass chrome goes
   away for a clean view (walk mode especially), leaving only the walk
   joystick + crosshair so you can still move and look. The tiny show button
   is the only chrome left, and it brings everything back. */
body.ui-hidden .floating-nav,
body.ui-hidden .bottom-dock,
body.ui-hidden .dock-hover-zone,
body.ui-hidden .walk-banner,
body.ui-hidden .right-inspector,
body.ui-hidden .device-menu,
body.ui-hidden #scaleBar,
body.ui-hidden #dockShowBtn { display: none !important; }

/* Dock minimize: the Hide button collapses the whole build dock to a small
   restore pill at the bottom, so the scene gets the full screen. Tapping the
   pill brings the dock straight back. */
body.dock-minimized .bottom-dock { display: none !important; }
.dock-show-btn {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.dock-show-btn.hidden { display: none; }

.ui-show-btn {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 60;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  cursor: pointer;
  padding: 0;
}
.ui-show-btn.hidden { display: none; }

.walk-crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.65);
  z-index: 31;
  pointer-events: none;
}

.toast-3d {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  padding: 7px 16px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  pointer-events: none;
}

/* Concentric Liquid Glass Side Drawers (Never overlap top nav or bottom dock!) */
.panel-3d {
  position: fixed;
  top: 86px;
  max-height: calc(100vh - 184px);
  overflow-y: auto;
  z-index: 20;
  border-radius: var(--lg-radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.left-drawer {
  left: 14px;
  width: 310px;
}

.right-inspector {
  right: 14px;
  width: 326px;
  /* Gentle retract: when you deselect, the inspector slides back to the
     right and fades over ~420ms — a smooth drawer retract, not an instant
     vanish. The .closing class drives it; .hidden removes it after.
     It slides in from the right on open, so open/close are symmetric. */
  transition: opacity 420ms ease, transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
  animation: inspectorIn 380ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes inspectorIn {
  from { opacity: 0; transform: translateX(64px); }
  to { opacity: 1; transform: translateX(0); }
}
.right-inspector.closing {
  animation: none;
  opacity: 0;
  transform: translateX(64px);
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.active-subtle {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.24);
  color: #fff;
}

.mini-tag {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 208, 102, 0.6);
  background: rgba(255, 208, 102, 0.18);
  color: #ffd066;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}

.toner-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.route-breadcrumb {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 208, 102, 0.12);
  border: 1px solid rgba(255, 208, 102, 0.4);
  font-size: 11px;
  line-height: 1.5;
  color: #fef3c7;
}
.route-step {
  display: inline-block;
  padding: 1px 6px;
  margin: 2px 1px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-family: "SF Mono", "Consolas", monospace;
  font-size: 10px;
}
.route-step.is-wall {
  border-color: #f87171;
  color: #fecaca;
}

.cable-list {
  max-height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cable-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 9px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  text-align: left;
  color: #fff;
  transition: background 140ms ease, border-color 140ms ease;
}
.cable-row:hover { background: rgba(88, 224, 255, 0.14); border-color: rgba(88, 224, 255, 0.45); }
.cable-row.is-toned { background: rgba(255, 208, 102, 0.22); border-color: #ffd066; }

.cable-top { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; font-weight: 700; font-family: "SF Mono", "Consolas", monospace; }
.cable-badge { font-size: 9.5px; padding: 1px 6px; border-radius: 999px; font-weight: 700; }
.cable-meta { font-size: 10.5px; color: var(--text-muted); display: flex; justify-content: space-between; }

/* Transform & Resize Card inside Right Inspector */
.transform-card {
  padding: 10px 11px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.transform-card input[type="range"] { width: 100%; accent-color: #58e0ff; cursor: pointer; }
.transform-btns { display: flex; gap: 6px; margin-top: 4px; }
.transform-btns .pill-btn { flex: 1; font-size: 11px; padding: 5px 8px; }

.inspector-section {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 9px;
}
#inspDeviceSections { padding-bottom: 8px; }

.kv-row { display: flex; justify-content: space-between; font-size: 11.5px; padding: 3px 0; }
.kv-row span:first-child { color: var(--text-muted); }
.kv-row span:last-child { font-weight: 600; font-family: "SF Mono", "Consolas", monospace; color: #fff; }

.port-trace-btn {
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  margin-bottom: 5px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 11px;
  font-family: "SF Mono", "Consolas", monospace;
  cursor: pointer;
}
.port-trace-btn:hover { border-color: #ffd066; background: rgba(255, 208, 102, 0.15); }

.code-block {
  margin-top: 6px;
  padding: 9px;
  border-radius: 11px;
  background: rgba(4, 7, 13, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-family: "SF Mono", "Consolas", monospace;
  font-size: 11px;
  line-height: 1.45;
  color: #dbeafe;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.code-block.is-empty {
  color: var(--text-muted);
  font-style: italic;
  background: transparent;
  border: none;
  padding: 2px 0;
}
.cable-path {
  display: block;
  font-family: "SF Mono", "Consolas", monospace;
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 2px;
}
.cable-lenbar {
  display: block;
  height: 4px;
  background: rgba(255, 255, 255, 0.09);
  border-radius: 2px;
  margin-top: 5px;
  overflow: hidden;
}
.cable-lenbar i {
  display: block;
  height: 100%;
  background: #58e0ff;
  border-radius: 2px;
}

/* 48-Port Switch Faceplate */
.switch-chassis {
  padding: 8px;
  border-radius: 10px;
  background: linear-gradient(180deg, #162032, #0c1320);
  border: 1px solid rgba(148, 163, 184, 0.35);
}
.sw-ports-wrap { display: flex; gap: 6px; align-items: center; }
.sw-copper-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; flex: 1; }
.sw-sfp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; padding-left: 5px; border-left: 1px solid rgba(255, 255, 255, 0.15); }
.sw-port {
  height: 17px; border-radius: 3px; border: 1px solid rgba(255, 255, 255, 0.14);
  background: #090d16; color: #64748b; font-family: "SF Mono", monospace; font-size: 8px; font-weight: 700; cursor: pointer; padding: 0;
}
.sw-port.is-live { background: rgba(52, 224, 161, 0.22); border-color: rgba(52, 224, 161, 0.65); color: #d1fae5; }
.sw-port.is-sfp.is-live { background: rgba(88, 224, 255, 0.24); border-color: #58e0ff; color: #e0f2fe; }
.sw-port.is-active { background: #ffd066 !important; border-color: #fff !important; color: #090d16 !important; transform: scale(1.14); }

/* Floating 3D Labels (Clean frosted pills) */
.node-label {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(8, 11, 18, 0.82);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.34);
  font-size: 11px;
  font-weight: 700;
  font-family: "SF Mono", "Consolas", monospace;
  color: #fff;
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}
.node-label.is-selected { border-color: #58e0ff; box-shadow: 0 0 16px rgba(88, 224, 255, 0.65); }
.node-label.is-toned { border-color: #22d3ee; color: #a5f3fc; box-shadow: 0 0 10px rgba(34, 211, 238, 0.45); }
/* Same-floor highlight: when a device is selected, every other device on its
   floor gets a warm amber glow (liquid glass, matching the gold accent) so the
   floor's devices read as a group at a glance. */
.node-label.same-floor { border-color: #f59e0b; box-shadow: 0 0 14px rgba(245, 158, 11, 0.55), 0 6px 16px rgba(0, 0, 0, 0.45); }

.jack-label {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(8, 12, 20, 0.86);
  border: 1px solid rgba(88, 224, 255, 0.5);
  color: #bae6fd;
  font-family: "SF Mono", monospace;
  font-size: 9.5px;
  font-weight: 700;
  pointer-events: auto;
  cursor: pointer;
}
.jack-label.is-toned { background: #ffd066; color: #090d16; border-color: #fff; }
.jack-label.cable-mid-label { color: #fde68a; border-color: rgba(255, 208, 102, 0.55); }
.scale-bar {
  position: fixed;
  left: 16px;
  bottom: 104px;
  z-index: 18;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
  font-family: "SF Mono", "Consolas", monospace;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}
.fps-chip {
  position: fixed;
  left: 16px;
  bottom: 80px;
  z-index: 18;
  pointer-events: none;
  font-family: "SF Mono", "Consolas", monospace;
  font-size: 10.5px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}
.scale-bar-line {
  display: block;
  height: 6px;
  border-left: 2px solid #fff;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  width: 120px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(2, 4, 10, 0.62);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-glass-card {
  width: min(500px, 94vw);
  padding: 20px 22px;
  border-radius: 28px;
}
.style-banner {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 45; padding: 12px 24px; border-radius: 999px;
  background: rgba(10, 14, 22, 0.88); border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff; font-weight: 700; pointer-events: none;
}


.room-verify-option { display: flex; align-items: center; gap: 6px; }
.room-verify-results:empty { display: none; }
.room-verify-results { font-size: 12px; line-height: 1.5; max-width: 280px; overflow-wrap: anywhere; }

/* Responsive studio chrome and blueprint options. */
.studio-3d .floating-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  z-index: 34;
}
.studio-3d .floating-nav .morph-pill { flex: 0 1 auto; max-width: 100%; }
.studio-3d .floating-nav .morph-group { flex-wrap: wrap; }
.studio-3d .utility-bar { flex-shrink: 0; }
.studio-3d:not(.xray-3d) #menubar .menubar-item,
.studio-3d:not(.xray-3d) #menubar .menubar-stat {
  color: #263341;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.82);
}
.studio-3d .glass-input { min-width: 0; }
.studio-3d.walking-3d #viewport { cursor: crosshair; }
.studio-3d.walking-3d #dock3dZone { display: none; }
.studio-3d .is-xray, .studio-3d .pill-btn[aria-pressed="true"] {
  background: rgba(94, 215, 246, 0.24);
  color: #e1f8ff;
}
.studio-3d .icon-btn:disabled { opacity: 0.38; cursor: default; }
.studio-3d .panel-3d { top: var(--studio-controls-bottom, 94px); max-height: min(660px, calc(100dvh - var(--studio-controls-bottom, 94px) - 92px)); }
.studio-3d .walk-banner { top: var(--studio-controls-bottom, 94px); max-width: min(540px, calc(100vw - 24px)); }
/* Menubar press feel (his Dec 3 call): the twin's logo — and every
   menubar item — dents in when pressed, like the 2D side, instead of
   navigating with no touch feedback at all. */
.studio-3d #menubar .menubar-item { transition: background 140ms ease, transform 120ms cubic-bezier(0.2, 0.9, 0.3, 1.35), filter 120ms ease; }
.studio-3d #menubar .menubar-item:active { transform: scale(0.92); filter: brightness(1.25); }
.studio-3d .left-drawer { width: min(310px, calc(100vw - 28px)); }
.studio-3d .right-inspector { width: min(326px, calc(100vw - 28px)); }
.studio-3d .delete-object { color: #ff867d; }
/* The inspector's Delete is a word, not a glyph: a 24px circle clips the
   text, and a "×" reads as "close" — which is exactly how routers got
   deleted by accident. Delete is a red text pill; the real close is the
   "×" next to it. */
#inspDeleteBtn {
  width: auto;
  min-width: 0;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  color: #ff867d;
  background: rgba(255, 91, 82, 0.14);
  border: 1px solid rgba(255, 91, 82, 0.35);
}
#inspDeleteBtn:hover { background: rgba(255, 91, 82, 0.24); color: #ffb3ad; }
.studio-3d .slider-head { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; }
.studio-3d .dock-hover-zone {
  width: max-content;
  max-width: calc(100% - 14px);
  padding-inline: 0;
}
.studio-3d .bottom-dock {
  display: flex;
  max-width: calc(100vw - 14px);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.studio-3d .bottom-dock::-webkit-scrollbar { display: none; }
.studio-3d .dock-item { flex-shrink: 0; }
.studio-3d .dock-sep { flex-shrink: 0; }
.place-floor {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-inline: 7px;
}
.place-floor select {
  color: #fff;
  background: rgba(9, 17, 27, 0.62);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 9px;
  font: inherit;
  padding: 3px 5px;
  cursor: pointer;
  color-scheme: dark;
}
.plan-menu { position: relative; }
.plan-menu summary { display: flex; list-style: none; cursor: pointer; }
.plan-menu summary::-webkit-details-marker { display: none; }
.plan-menu-panel {
  position: absolute;
  z-index: 36;
  top: calc(100% + 10px);
  left: 0;
  width: min(264px, calc(100vw - 24px));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  white-space: normal;
  gap: 9px;
  padding: 13px;
  border-radius: 16px;
  font-size: 12px;
}
.plan-menu-panel .pill-btn { justify-content: center; }
.plan-menu-panel small, .checkout-status { color: var(--text-secondary); }
.plan-menu-panel a { color: #d4f4ff; text-underline-offset: 3px; width: fit-content; }
.pro-feature-list { margin: 14px 0; padding-left: 19px; font-size: 13px; line-height: 1.7; }
.checkout-status { margin: 0; font-size: 12px; }

@media (max-width: 760px), (max-height: 500px) and (orientation: landscape) {
  .studio-3d #topoTitle, .studio-3d #nodeCountStat { display: none; }
  .studio-3d #menubar {
    top: env(safe-area-inset-top, 0px);
    height: 32px;
    padding-inline: max(8px, env(safe-area-inset-left, 0px)) max(8px, env(safe-area-inset-right, 0px));
    z-index: 40;
  }
  /* INVERTED (Dec 2 ~13:12, his call): the 3D toolbar does NOT pop up
     when you switch to 3D — you land on a clean scene, and you press ☰
     to show it. This is safe now because the ☰ toggle actually works
     (v=57 fixed the ui-hidden !important that used to block it); the
     v=53 drawer stranded him only because the toggle was broken then.
     The ☰ button lives in the menubar (always visible), so Topology is
     always one tap away — tap ☰, tap Topology. Default is hidden.
     LANDSCAPE (Dec 2 ~13:59, his call): this block also applies on short
     landscape screens (phone turned sideways, ~402px tall). Before, the
     760px width gate meant landscape (844px wide) got the desktop layout
     — toolbar always visible, no ☰ to minimize it — so the two-row
     toolbar ate the short landscape screen and he was stuck with it. */
  .studio-3d .floating-nav {
    /* Undo the phone drawer (liquid_glass.css turns .floating-nav into a
       hidden left slide-in drawer on phones: translateX(-115%),
       visibility hidden, dark glass, 300px wide). The 3D toolbar is a
       top row when shown — reset every drawer property back to the
       top-row layout. It starts HIDDEN and ☰ shows it — but hidden via
       transform/opacity/visibility, NOT display:none, so it slides down
       smoothly instead of snapping in/out (his Dec 2 ~13:59 call). */
    display: flex;
    left: max(14px, env(safe-area-inset-left, 0px));
    right: max(14px, env(safe-area-inset-right, 0px));
    top: calc(50px + env(safe-area-inset-top, 0px));
    bottom: auto;
    width: auto; max-width: none;
    flex-direction: row; flex-wrap: wrap; justify-content: flex-start; align-items: center;
    gap: 8px; padding: 0;
    overflow: visible;
    background: transparent;
    -webkit-backdrop-filter: none; backdrop-filter: none;
    border: none; border-right: none; border-radius: 0;
    box-shadow: none;
    transform: translateY(-140%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1), opacity 300ms ease, visibility 420ms;
  }
  body.studio-3d.mobile-nav-open .floating-nav {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  /* Belt-and-braces: if ui-hidden ever gets set (it used to be forced on
     in portrait by the orientation sync), tapping ☰ must still show the
     toolbar — mobile-nav-open beats ui-hidden's !important hide. */
  body.ui-hidden.studio-3d.mobile-nav-open .floating-nav {
    display: flex !important;
    transform: translateY(0) !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
  .studio-3d .floating-nav > .morph-pill { order: 3; }
  .studio-3d .floating-nav > .utility-bar { margin-left: auto; }
  /* Thumb-sized ☰: the menubar button was a small ~28px tap target, so
     taps missed and it took several tries. 44px on phones. display:
     inline-flex here so the ☰ shows in landscape too — the base rule
     hides it and liquid_glass only shows it ≤760px wide, so without this
     there'd be no way to minimize the toolbar when the phone is sideways. */
  .studio-3d #btn-mobile-nav { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; font-size: 20px; touch-action: manipulation; }
  .studio-3d .walk-joystick {
    left: max(18px, env(safe-area-inset-left, 0px));
    bottom: max(90px, calc(env(safe-area-inset-bottom, 0px) + 74px));
  }
  .studio-3d .panel-3d { padding: 10px; }
  .studio-3d .walk-banner { white-space: normal; }
  .studio-3d .dock-item { padding-inline: 4px; }
  .studio-3d .panel-3d.right-inspector {
    left: 8px;
    right: 8px;
    width: auto;
    top: auto;
    bottom: 104px;
    max-height: 44dvh;
  }
}

@media (max-width: 460px) {
  .studio-3d .floating-nav > .utility-bar { margin-left: auto; }
  .studio-3d .floating-nav .seg-btn { padding-inline: 5px; }
  .studio-3d .utility-bar .sq-icon { width: 23px; min-width: 23px; }
  .studio-3d .dock-squircle { width: 36px; height: 36px; }
  .studio-3d .dock-item { min-width: 40px; }
  .studio-3d .dock-label { font-size: 9px; }
}

/* iPhone touch: the canvas owns every gesture — no page scroll, pinch-zoom, or callout fighting the 3D controls. */
body.studio-3d { overscroll-behavior: none; }
#viewport, #viewport canvas {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.walk-joystick {
  position: fixed;
  left: 18px;
  bottom: 118px;
  z-index: 22;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: rgba(10, 16, 28, 0.42);
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  touch-action: none;
  display: none;
}
body.walking-3d .walk-joystick.is-touch { display: block; }
body.flying-3d .walk-joystick.is-touch { display: block; }
.fly-lift {
  position: fixed;
  right: 18px;
  bottom: 118px;
  z-index: 22;
  display: none;
  flex-direction: column;
  gap: 12px;
}
body.flying-3d .fly-lift.is-touch { display: flex; }
.fly-lift button {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  background: rgba(10, 16, 28, 0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 20px;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.fly-lift button:active { background: rgba(53, 196, 255, 0.35); }
.walk-joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.device-menu {
  position: fixed;
  z-index: 40;
  width: 264px;
  max-height: min(420px, calc(100dvh - 120px));
  overflow-y: auto;
  /* The surface is the shared liquid glass (liquid-glass class on the
     element): same refraction, rim and specular as every other panel, not
     a flat dark card. Only layout lives here. */
  border-radius: 26px;
  padding: 12px;
  color: #e2e8f0;
  touch-action: manipulation;
  /* Liquid open/close (his Dec 3 call): the menu used to pop in and out
     on a display toggle. Now it fades and settles with a breath of
     scale — open via .menu-anim-in, close via .menu-closing. */
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.device-menu.menu-anim-in { animation: deviceMenuIn 0.2s cubic-bezier(0.2, 0.9, 0.25, 1.15); }
@keyframes deviceMenuIn {
  from { opacity: 0; transform: scale(0.96) translateY(5px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.device-menu.menu-closing { opacity: 0; transform: scale(0.97) translateY(3px); pointer-events: none; }
.device-menu-radius-val { align-self: center; font-size: 12.5px; font-weight: 650; opacity: 0.85; min-width: 44px; text-align: center; }
.device-menu-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.device-menu-head b { font-size: 15px; }
.device-menu-head span { font-size: 12px; opacity: 0.65; }
.device-menu-close { margin-left: auto; background: none; border: none; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; opacity: 0.7; padding: 2px 6px; }
.device-menu-label { display: block; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.6; margin: 10px 0 5px; }
.device-menu input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font: inherit;
  font-size: 14px;
  outline: none;
}
.device-menu-list { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.device-menu-vendor {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 10px; border-radius: 9px; border: none; background: none; color: inherit;
  font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.device-menu-vendor:hover { background: rgba(255, 255, 255, 0.1); }
/* Slide highlight mirrors :hover so a press-and-slide through the vendor
   list visibly tracks the finger, same as the 2D context menus. */
.device-menu-vendor.slide-hover { background: rgba(255, 255, 255, 0.14); }
.device-menu-vendor.is-current { background: rgba(91, 228, 255, 0.16); }
.device-menu-vendor .tick { opacity: 0.7; font-size: 12px; }
.device-menu-types { display: flex; flex-wrap: wrap; gap: 6px; }
.device-menu-type {
  padding: 7px 10px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06); color: inherit; font: inherit; font-size: 13px; cursor: pointer;
}
.device-menu-type:hover { background: rgba(255, 255, 255, 0.12); }
.device-menu-type.slide-hover { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.35); }
.device-menu-type.is-current { background: rgba(91, 228, 255, 0.2); border-color: rgba(91, 228, 255, 0.6); }

.plan-menu-panel > * { min-width: 0; max-width: 100%; }
.plan-menu-panel .glass-input { width: 100%; box-sizing: border-box; }
.plan-menu-panel small { line-height: 1.4; }
.studio-3d.walking-3d .node-label {
  pointer-events: none;
  padding: 3px 8px;
  font-size: 11px;
  font-family: inherit;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

/* Cable isolation and readable endpoint mapping. */
.cable-length { color: #b3bccb; font-size: 10px; flex-shrink: 0; }
.cable-ends { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; align-items: center; }
.cable-ends > span:not(.cable-arrow) { display: grid; gap: 2px; overflow-wrap: anywhere; font-size: 10.5px; }
.cable-ends code, .trace-endpoint code { font: 10px "SF Mono", Consolas, monospace; color: #b7edff; overflow-wrap: anywhere; }
.cable-arrow { color: #a5b6c5; }
.trace-endpoints { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; }
.trace-endpoint {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 7px;
  text-align: left;
  overflow-wrap: anywhere;
  border-radius: 8px;
  border: 1px solid rgba(255, 210, 131, 0.28);
  background: rgba(15, 21, 32, 0.72);
  color: #fff;
  cursor: pointer;
}
.trace-endpoint:hover, .trace-endpoint:focus-visible { border-color: #ffd683; }
.trace-floor, .trace-endpoint small { color: #f0cc8b; font-size: 10px; }
.trace-path-title { font-size: 10px; color: #f3d9a6; margin-bottom: 3px; }
.trace-pin-label { pointer-events: none; font-size: 10px; }

.trace-path-header { display: flex; gap: 5px; justify-content: space-between; align-items: baseline; }
.trace-frame {
  border: 0;
  padding: 0 2px 4px;
  background: none;
  color: #fff0cb;
  font-size: 10px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* Labels toggle as a real switch (not a pill button): a track that lights
   up when on, with a knob that slides across. Reads as on/off at a glance. */
.switch-btn { gap: 8px; }
.switch-track {
  width: 34px; height: 20px; border-radius: 999px; flex-shrink: 0;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  position: relative;
  transition: background 180ms ease, border-color 180ms ease;
}
.switch-knob {
  position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
.switch-btn.active .switch-track,
.switch-btn[aria-pressed="true"] .switch-track {
  background: #34e07c;
  border-color: #34e07c;
}
.switch-btn.active .switch-knob,
.switch-btn[aria-pressed="true"] .switch-knob {
  transform: translateX(14px);
}

/* ---- Floors menu: view / combine / place in one liquid panel ---- */
.floors-panel { min-width: 216px; }
.floors-options { display: flex; flex-direction: column; gap: 4px; }
.floors-opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.10); background: rgba(255, 255, 255, 0.05); color: inherit; font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.floors-opt:hover { background: rgba(255, 255, 255, 0.11); }
.floors-opt.is-active { border-color: rgba(94, 224, 255, 0.55); background: rgba(56, 189, 248, 0.15); }
.floors-check { color: #5ee4ff; font-weight: 700; }

/* ---- Blueprint hold-menu: Camera / Video / Upload data ---- */
.bp-quick { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 88px); transform: translateX(-50%); z-index: 92; display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 20px; min-width: 224px; }
.bp-quick.hidden { display: none; }
.bp-quick-item { padding: 11px 14px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.10); background: rgba(255, 255, 255, 0.05); color: inherit; font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.bp-quick-item.is-hot { border-color: rgba(94, 224, 255, 0.60); background: rgba(56, 189, 248, 0.16); }

/* ---- Pro badge: liquid glass, a soft gold/violet glow, OLED-black
   depth — and on hover the glow blooms and a sheen sweeps across ---- */
.pro-badge { position: relative; overflow: hidden; border-radius: 999px; border: 1px solid rgba(255, 205, 120, 0.45); background: linear-gradient(180deg, rgba(34, 27, 10, 0.94), rgba(5, 4, 10, 0.97)); box-shadow: 0 0 14px rgba(245, 197, 66, 0.28), 0 0 30px rgba(139, 92, 246, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -8px 14px rgba(0, 0, 0, 0.55); transition: box-shadow 0.35s ease, border-color 0.35s ease; }
.studio-3d:not(.xray-3d) #menubar .menubar-item.pro-badge { color: #ffe9b8; text-shadow: 0 1px 6px rgba(245, 197, 66, 0.35); }
.pro-badge:hover { border-color: rgba(255, 214, 140, 0.85); box-shadow: 0 0 22px rgba(245, 197, 66, 0.52), 0 0 48px rgba(139, 92, 246, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.30), inset 0 -8px 14px rgba(0, 0, 0, 0.50); }
.pro-badge::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%); transform: translateX(-120%); transition: transform 0.6s ease; pointer-events: none; }
.pro-badge:hover::after { transform: translateX(120%); }
.pro-badge .palette-gem { box-shadow: 0 0 8px rgba(245, 197, 66, 0.85); }
/* The surge (his Dec 3 call): with Hide Pro gone, the badge itself
   breathes — a slow gold/violet glow swell with a barely-there lift,
   restrained enough to live in the menubar full-time. */
.pro-badge { animation: proSurge 3.4s ease-in-out infinite; }
/* Pro ACTIVE on this device: the surge calms and the gem goes green —
   owned, not advertising. */
.pro-badge.is-pro { animation: none; border-color: rgba(110, 255, 175, 0.55); box-shadow: 0 0 14px rgba(52, 224, 124, 0.30), 0 0 30px rgba(139, 92, 246, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -8px 14px rgba(0, 0, 0, 0.55); }
.pro-badge.is-pro .palette-gem { background: #34e07c; box-shadow: 0 0 8px rgba(52, 224, 124, 0.9); }
@keyframes proSurge {
  0%, 100% { box-shadow: 0 0 14px rgba(245, 197, 66, 0.28), 0 0 30px rgba(139, 92, 246, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 -8px 14px rgba(0, 0, 0, 0.55); transform: scale(1); }
  50% { box-shadow: 0 0 24px rgba(245, 197, 66, 0.55), 0 0 52px rgba(139, 92, 246, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.30), inset 0 -8px 14px rgba(0, 0, 0, 0.50); transform: scale(1.03); }
}

/* The device menu is used with a visible cursor (pointer lock is
   released while it is open in Walk mode) — rows read as clickable. */
.device-menu { cursor: default; }

/* Room accuracy feedback (his Dec 3 loop): every generated room can be
   graded against reality; entries log locally and send to the bridge. */
.feedback-card { position: fixed; right: 16px; bottom: 16px; z-index: 70; width: min(320px, calc(100vw - 24px)); border-radius: 20px; padding: 14px 16px; }
.feedback-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.feedback-title { font-size: 14px; font-weight: 700; }
.feedback-x { background: none; border: none; color: inherit; font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 6px; }
.feedback-pred { font-size: 11.5px; opacity: .75; margin-bottom: 10px; line-height: 1.45; }
.feedback-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 12.5px; }
.feedback-row span { flex: 1; font-weight: 600; }
.fb-toggle[aria-pressed="true"] { outline: 2px solid #58e0ff; outline-offset: 1px; }
.feedback-label { display: block; font-size: 11.5px; font-weight: 600; opacity: .85; margin: 8px 0 4px; }
.feedback-card .glass-input { width: 100%; box-sizing: border-box; }
.feedback-actions { display: flex; gap: 6px; margin-top: 12px; }
.feedback-count { font-size: 11px; opacity: .6; margin-top: 8px; }
@media (max-width: 760px) { .feedback-card { right: 12px; left: 12px; width: auto; bottom: max(12px, env(safe-area-inset-bottom)); } }
.device-menu-vendor, .device-menu-type { cursor: pointer; }
