/* =========================================================
   SculptGL — Nomad theme skin (CSS only)

   Loaded AFTER yagui.css so it overrides cleanly. Re-skins
   the yagui GUI (.gui-topbar / .gui-sidebar / buttons /
   sliders / etc.) to a light, Nomad-Sculpt style:
   white viewport, glassmorphism panels, orange accents.

   Scope: presentation only. No engine / src/math3d touched.
   Accent (#E25822) is used ONLY for active/hover/checked/
   focused states; inactive controls stay neutral gray.

   Note: the 3-D backdrop behind the model is the WebGL clear
   color set by the renderer, not CSS — to lighten it use the
   in-app "Background" menu. CSS only recolors the GUI chrome.
   ========================================================= */

/* ── palette ──────────────────────────────────────────────
   --nm-bg      white viewport
   --nm-glass   translucent panel base
   --nm-accent  Nomad orange (active/hover/checked/focus only)
   --nm-text    dark neutral, readable on light glass
   --nm-fill    neutral control fill (inactive)              */
:root {
  --nm-bg:        #FFFFFF;
  --nm-glass:     rgba(248, 248, 245, 0.72);
  --nm-glass-2:   rgba(248, 248, 245, 0.96);
  --nm-accent:    #E25822;
  --nm-accent-2:  #F0703A;
  --nm-toggle:    #22C55E;
  --nm-text:      #4a4a4a;
  --nm-text-strong: #333333;
  --nm-fill:      #ECECE6;
  --nm-fill-h:    #E2E2DA;
  --nm-border:    rgba(0, 0, 0, 0.06);
  --nm-shadow:    0 4px 20px rgba(0, 0, 0, 0.08);
  --nm-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* ── viewport / global text ─────────────────────────────── */
body,
#viewport,
#canvas { background: var(--nm-bg); }

/* The WebGL clear color is transparent (gl.clearColor(0,0,0,0) in the engine),
   so the canvas CSS background shows through. yagui.css paints #canvas #3c3c3c
   at equal specificity — force white over it (!important wins). */
#canvas { background: #FFFFFF !important; }
body,
#viewport { background: #FFFFFF !important; }

* { color: var(--nm-text); }

/* =========================================================
   SIDE BAR — slim glass panel
   ========================================================= */
.gui-sidebar {
  width: 210px;                         /* 310 -> 210, slimmer */
  background: var(--nm-glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--nm-border);   /* was 4px double */
  border-radius: 12px;
  box-shadow: var(--nm-shadow);
}
.gui-resize { left: 210px; }            /* keep resize handle aligned */

.gui-sidebar::-webkit-scrollbar { background: rgba(0, 0, 0, 0.04); }
.gui-sidebar::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.18); }

/* folder section labels */
.gui-sidebar > ul > label {
  color: var(--nm-text-strong);
  background: rgba(0, 0, 0, 0.04);
}
.gui-glowOnHover:hover { background: rgba(0, 0, 0, 0.05); }

/* =========================================================
   TOP BAR — thin glass bar
   ========================================================= */
.gui-topbar {
  background: var(--nm-glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--nm-border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}
.gui-topbar ul > li { line-height: 36px; }      /* slightly thinner bar */
.gui-topbar ul > li:hover { color: var(--nm-accent); }   /* accent hover */

/* dropdown menus -> light glass */
.gui-topbar ul > li > ul {
  background: var(--nm-glass-2);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--nm-border);
  border-radius: 10px;
  box-shadow: var(--nm-shadow-lg);
  max-height: calc(100vh - 56px);
  overflow-y: auto;
}
.gui-topbar ul > li > ul > li:hover { color: var(--nm-accent); }

.gui-topbar .nm-files-menu > ul,
.gui-topbar .nm-toy-menu > ul,
.gui-topbar .nm-render-menu > ul,
.gui-topbar .nm-scene-menu > ul,
.gui-topbar .nm-boolean-menu > ul,
.gui-topbar .nm-facegroup-menu > ul {
  width: min(280px, calc(100vw - 32px));
  overflow-x: hidden;
}

/* Pinned (clicked-open) topbar menu: stays open regardless of hover, so the
   cursor can cross the hover dead-zone to reach the menu items.
   Mirrors the :hover open state. */
.gui-topbar .nm-scene-menu.nm-pinned > ul,
.gui-topbar .nm-ai3d-menu.nm-pinned > ul,
.gui-topbar .nm-boolean-menu.nm-pinned > ul {
  display: block;
  opacity: 1;
  pointer-events: auto;
  top: 30px;
}

.gui-topbar .nm-facegroup-menu > ul > li {
  min-height: 24px;
}

.gui-topbar .nm-facegroup-menu .gui-label-side {
  width: 42%;
  text-align: left;
}

.gui-topbar .nm-facegroup-menu .gui-slider {
  width: 36%;
}

/* Wider labels so Cut-in-Half + Rendering controls show their full text. */
.gui-topbar .nm-cutinhalf-menu .gui-label-side,
.gui-topbar .nm-render-menu .gui-label-side {
  width: 56%;
  text-align: left;
  overflow: visible;
  text-overflow: clip;
}
.gui-topbar .nm-cutinhalf-menu .nm-toy-toggle-content .gui-label-side,
.gui-topbar .nm-render-menu .nm-toy-toggle-content .gui-label-side {
  width: 56%;
}

/* Make the Cut-in-Half sliders VISIBLE and organize the Connectors rows. yagui's
   addSlider builds a real draggable .gui-slider (track + accent fill) + a number input,
   but the slider has height:100% while the row <li> has no explicit height → it
   collapses to 0px. Using FLEXBOX (not floats) gives each row a real height and stops
   floated children leaking into the next row. Slider rows: label on its own line, then
   a wide slider + value. Combobox (Shape) row: label + dropdown on one line. */
.gui-topbar .nm-cutinhalf-menu li:has(> .gui-slider) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  height: auto;
  padding: 3px 10px 5px;
  row-gap: 2px;
  column-gap: 6px;
}
.gui-topbar .nm-cutinhalf-menu li:has(> .gui-slider) .gui-label-side {
  flex: 1 0 100%;
  width: auto;
  float: none;
  display: block;
  text-align: left;
  height: 15px;
  line-height: 15px;
}
.gui-topbar .nm-cutinhalf-menu li:has(> .gui-slider) .gui-slider {
  flex: 1 1 auto;
  float: none;
  height: 12px;
  margin: 0;
}
.gui-topbar .nm-cutinhalf-menu li:has(> .gui-slider) .gui-input-number {
  flex: 0 0 38px;
  width: 38px;
  float: none;
}
.gui-topbar .nm-cutinhalf-menu li:has(> .gui-select),
.gui-topbar .nm-render-menu li:has(> .gui-select) {
  display: flex;
  align-items: center;
  column-gap: 6px;
  padding: 3px 10px;
}
.gui-topbar .nm-cutinhalf-menu li:has(> .gui-select) .gui-label-side,
.gui-topbar .nm-render-menu li:has(> .gui-select) .gui-label-side {
  flex: 0 0 auto;
  width: auto;
  float: none;
}
.gui-topbar .nm-cutinhalf-menu li:has(> .gui-select) .gui-select,
.gui-topbar .nm-render-menu li:has(> .gui-select) .gui-select {
  flex: 1 1 auto;
  width: auto;
  float: none;
}

/* Mask menu (GuiMask): same flex layout as Cut-in-Half so Thickness/Depth render as
   draggable sliders (the gui-slider track otherwise collapses to 0px) and the
   connector dropdown sits on its own row (was overlapping the "Segmentation" title). */
.gui-topbar .nm-mask-menu li:has(> .gui-slider) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  height: auto;
  padding: 3px 10px 5px;
  row-gap: 2px;
  column-gap: 6px;
}
.gui-topbar .nm-mask-menu li:has(> .gui-slider) .gui-label-side {
  flex: 1 0 100%;
  width: auto;
  float: none;
  display: block;
  text-align: left;
  height: 15px;
  line-height: 15px;
}
.gui-topbar .nm-mask-menu li:has(> .gui-slider) .gui-slider {
  flex: 1 1 auto;
  float: none;
  height: 12px;
  margin: 0;
}
.gui-topbar .nm-mask-menu li:has(> .gui-slider) .gui-input-number {
  flex: 0 0 38px;
  width: 38px;
  float: none;
}
.gui-topbar .nm-mask-menu li:has(> .gui-select) {
  display: flex;
  align-items: center;
  column-gap: 6px;
  padding: 3px 10px;
}
.gui-topbar .nm-mask-menu li:has(> .gui-select) .gui-label-side {
  flex: 0 0 auto;
  width: auto;
  float: none;
}
.gui-topbar .nm-mask-menu li:has(> .gui-select) .gui-select {
  flex: 1 1 auto;
  width: auto;
  float: none;
}

.gui-topbar .nm-facegroup-menu .gui-input-number {
  width: 18%;
  margin-left: 2%;
}

.gui-topbar .nm-facegroup-menu .nm-active {
  color: var(--nm-accent);
}

.nm-facegroup-active-paint {
  height: auto !important;
  margin: 6px 0;
  padding: 0 4px;
  line-height: 1.2;
}

.nm-facegroup-active-paint button {
  display: grid;
  width: 100%;
  min-height: 30px;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--nm-border);
  border-radius: 6px;
  background: rgba(245, 245, 242, 0.9);
  color: var(--nm-text);
  font: inherit;
  cursor: pointer;
}

.nm-facegroup-active-paint output {
  color: var(--nm-text-strong);
  font: inherit;
  white-space: nowrap;
}

.nm-facegroup-active-paint button::after {
  content: '+';
  color: var(--nm-accent);
  font-weight: 700;
}

.nm-facegroup-active-paint.nm-open button::after {
  content: '-';
}

.nm-facegroup-swatches {
  display: grid !important;
  height: auto !important;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
}

.nm-facegroup-swatches.nm-collapsed {
  display: none !important;
}

.nm-facegroup-swatch,
.nm-facegroup-add-color {
  width: 100%;
  min-width: 0;
  height: 28px;
  border: 2px solid var(--nm-border);
  border-radius: 6px;
  cursor: pointer;
}

.nm-facegroup-swatch.nm-active {
  border-color: var(--nm-text-strong);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.95);
}

.nm-facegroup-add-color {
  background: var(--nm-glass);
  color: var(--nm-accent);
  font: 700 18px/1 Arial, Helvetica, sans-serif;
}

.nm-facegroup-add-color:disabled {
  color: var(--nm-text-muted);
  cursor: not-allowed;
}

.nm-facegroup-workspace-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: #ffffff;
}

.nm-facegroup-workspace-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

/* Nested toggle used to keep heavier tool groups inside one topbar tab. */
.gui-topbar .nm-toy-toggle {
  float: none;
  height: auto;
  margin: 8px 0 0;
  padding: 0;
  line-height: 1.2;
  clear: both;
}
.gui-topbar .nm-toy-toggle:hover { color: var(--nm-text); }
.nm-toy-toggle-btn {
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-bottom: 1px solid var(--nm-border);
  background: transparent;
  color: var(--nm-text-strong);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.nm-toy-toggle-btn::after {
  content: '+';
  float: right;
  color: var(--nm-accent);
}
.nm-toy-toggle.nm-open > .nm-toy-toggle-btn::after { content: '-'; }
.nm-toy-toggle-btn:hover { color: var(--nm-accent); }
.nm-toy-toggle-content {
  position: static !important;
  float: none !important;
  display: block;
  min-width: 100%;
  margin: 0;
  padding: 0;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  overflow-x: hidden;
}
.nm-toy-toggle-content > li {
  float: none !important;
  clear: both;
  width: 100%;
  height: 24px;
  margin: 6px 0;
  padding: 0 4px;
  line-height: 24px;
  overflow: hidden;
}
.nm-toy-toggle-content .group-title {
  clear: both;
  height: auto;
  min-height: 26px;
  padding: 8px 0 6px;
  line-height: 1.25;
  white-space: normal;
  text-align: center;
}
.nm-toy-toggle-content .gui-label-side {
  width: 42%;
  height: 24px;
  line-height: 24px;
  text-align: left;
}
.nm-toy-toggle-content .gui-slider {
  width: 36%;
  height: 22px;
  margin-top: 1px;
}
.nm-toy-toggle-content .gui-input-number {
  width: 18%;
  height: 22px;
  margin-top: 1px;
  margin-left: 2%;
}
.nm-toy-toggle-content .gui-button {
  height: 22px;
  line-height: 22px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nm-toy-toggle-content .gui-input-checkbox + label {
  margin-top: 3px;
}
.nm-toy-toggle-content[hidden] { display: none !important; }

/* group titles inside menus */
.group-title {
  color: var(--nm-text-strong) !important;
  border-bottom: 1px solid var(--nm-border);
}

/* =========================================================
   CONTROLS
   ========================================================= */

/* number input */
.gui-input-number {
  background: rgba(0, 0, 0, 0.05);
  color: var(--nm-text);
}

/* slider: neutral track, ORANGE fill */
.gui-slider { background: rgba(0, 0, 0, 0.06); }
.gui-slider > div { background: var(--nm-accent); }

.gui-slider:hover,
.gui-input-number:hover { background: rgba(0, 0, 0, 0.10); }

/* button: neutral by default, ORANGE on hover/active */
.gui-button {
  background: var(--nm-fill);
  color: var(--nm-text);
}
.gui-button:enabled:hover {
  background: var(--nm-fill-h);
  color: var(--nm-accent);
}
.gui-button:active {
  background: var(--nm-accent);
  color: #ffffff;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.25);
}
.gui-button:disabled {
  background: #E8E8E3;
  color: #bdbdb8;
}

/* select: neutral, ORANGE focus outline / hover */
.gui-select {
  background: var(--nm-fill);
  color: var(--nm-text);
}
.gui-select:hover { color: var(--nm-accent); }
.gui-select:focus { outline: 2px solid var(--nm-accent); }

/* checkbox: neutral box, ORANGE when checked */
.gui-input-checkbox + label { border-color: rgba(0, 0, 0, 0.3); }
.gui-input-checkbox:checked + label {
  background: var(--nm-accent);
  border-color: var(--nm-accent);
}
.gui-input-checkbox:checked + label::before { border-color: #ffffff; }  /* white check on orange */

/* color-picker popup frame -> light */
.gui-widget-color > input + div { background: var(--nm-glass-2); }

/* =========================================================
   LEFT TOOL DOCK — slim fixed glass bar (Nomad-style)
   Only the LEFT sidebar carries .nm-leftbar, so these rules
   never touch the right sidebar (.gui-sidebar alone).
   Phase 2a: shell + placeholder cells. Polished in 2e.
   ========================================================= */
.gui-sidebar.nm-leftbar {
  left: 0;
  width: 72px;                  /* slim dock (overrides the 210px rule) */
  padding: 8px 0 20px;
  border-right: 1px solid var(--nm-border);
  border-radius: 0 12px 12px 0;
}

.nm-leftbar-inner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 0 4px;
}

.nm-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50px;            /* uniform height across all 7 cells */
  padding: 6px 4px;
  border-radius: 8px;
  cursor: pointer;
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
}
.nm-cell:hover { background: rgba(0, 0, 0, 0.05); }

/* 24x24 placeholder icon (swapped for real glyphs later) */
.nm-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--nm-fill);
}

.nm-label {
  margin-top: 3px;
  max-width: 100%;
  font-size: 10px;
  line-height: 1.1;
  text-align: center;
  color: var(--nm-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* active toggle: ICON + LABEL turn orange (no full-cell fill) */
.nm-leftbar .nm-cell.nm-on .nm-icon { background: var(--nm-accent); }
.nm-leftbar .nm-cell.nm-on .nm-label { color: var(--nm-accent); }

/* green toggle-type cells (isolate, xray) — override orange with green */
.nm-leftbar .nm-cell.nm-toggle.nm-on .nm-icon  { background: var(--nm-toggle); }
.nm-leftbar .nm-cell.nm-toggle.nm-on .nm-label { color: var(--nm-toggle); }

/* undo/redo click flash — brief green highlight */
.nm-leftbar .nm-cell.nm-flash .nm-icon  { background: var(--nm-toggle); }
.nm-leftbar .nm-cell.nm-flash .nm-label { color: var(--nm-toggle); }

/* disabled cell (e.g. Invert when the active tool has no negative) */
.nm-leftbar .nm-cell.nm-disabled,
.nm-rightbar .nm-cell.nm-disabled { opacity: 0.4; pointer-events: none; }

/* slider cell: label above a thin VERTICAL track (Radius / Intensity).
   The track runs down the horizontal center of the 50px cell. The thumb
   is wider than the track so it sticks out both sides — overflow:visible
   on the track lets it render without clipping. Shared by the left dock
   and the right tool rail (GuiSidebarRight ports the same widget). */
.nm-leftbar .nm-slidercell,
.nm-rightbar .nm-slidercell {
  height: 142px;                  /* 138px slider + 2+2px padding (was 50px) so the 3x track fits without shrinking */
  padding: 2px 4px;               /* minimal vertical padding — track fills the cell */
  overflow: visible;              /* thumb protrudes past cell border on L/R */
  cursor: default;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
/* Hide the text label inside slider cells — track fills the full height */
.nm-leftbar .nm-slidercell .nm-label,
.nm-rightbar .nm-slidercell .nm-label { display: none; }
.nm-leftbar .nm-slider,
.nm-rightbar .nm-slider {
  position: relative;
  width: 6px;                     /* thin vertical track */
  height: 138px;                  /* 3x taller (was 46px); thumb/fill scale with track */
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.10);
  cursor: ns-resize;
  overflow: visible;              /* thumb overflows on both sides */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.nm-leftbar .nm-slider-fill,
.nm-rightbar .nm-slider-fill {
  position: absolute;
  left: 0;
  bottom: 0;                      /* fill grows from bottom upward */
  width: 100%;
  height: 0;
  border-radius: 0 0 3px 3px;
  background: var(--nm-accent);
  pointer-events: none;
}
.nm-leftbar .nm-slider-thumb,
.nm-rightbar .nm-slider-thumb {
  position: absolute;
  left: 50%;
  bottom: 0;                      /* JS drives this via style.bottom */
  width: 12px;
  height: 12px;
  margin-left: -6px;
  margin-bottom: -6px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid var(--nm-accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}
.nm-leftbar .nm-slider:hover .nm-slider-thumb,
.nm-leftbar .nm-slider.nm-dragging .nm-slider-thumb,
.nm-rightbar .nm-slider:hover .nm-slider-thumb,
.nm-rightbar .nm-slider.nm-dragging .nm-slider-thumb {
  box-shadow: 0 0 0 3px rgba(226, 88, 34, 0.25);
}

/* ============================================================
   Phase 3: Right-side tool rack
   .nm-rightbar-inner sits at the top of the right .gui-sidebar,
   prepended before the collapsible menus.
   ============================================================ */
/* Right sidebar opens slim by default (matches the 72px left dock).
   Users can still drag .gui-resize to widen it; that sets an inline
   width which overrides this rule. */
.gui-sidebar.nm-rightbar {
  width: 72px;
}

.nm-rightbar-inner {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 6px 4px;
}

.nm-tool-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 4px 2px;
  border-radius: 8px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: background 0.1s;
}

.nm-tool-cell:hover {
  background: rgba(0, 0, 0, 0.06);
}

.nm-tool-cell.nm-on {
  background: var(--nm-accent);
}

.nm-tool-cell.nm-on .nm-tool-icon,
.nm-tool-cell.nm-on .nm-label {
  color: #ffffff;
}

.nm-tool-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--nm-text);
}

.nm-tool-icon svg {
  width: 100%;
  height: 100%;
}

/* ── Nav Cube ─────────────────────────────────────────────── */
.nav-cube-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--nm-text);
  background: rgba(248, 248, 245, 0.65);
  border: 1px solid rgba(74, 74, 74, 0.20);
  box-sizing: border-box;
  cursor: pointer;
  pointer-events: auto;
  -webkit-user-select: none;
  user-select: none;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.nav-cube-face:hover {
  background: rgba(226, 88, 34, 0.15);
  border-color: var(--nm-accent);
  color: var(--nm-accent);
}
.nav-cube-face.navcube-active {
  background: rgba(226, 88, 34, 0.28);
  border-color: var(--nm-accent);
  color: var(--nm-accent);
}

.nm-tool-cell .nm-label {
  font-size: 8px;
  margin-top: 3px;
  color: var(--nm-text);
  opacity: 0.65;
  text-align: center;
  line-height: 1.1;
}

.nm-tool-cell.nm-on .nm-label {
  opacity: 1;
}

/* ── Snap-rotation step popup ─────────────────────────────── */
.nm-snap-popup {
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: rgba(248, 248, 245, 0.96);
  border: 1px solid rgba(74, 74, 74, 0.20);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  font-size: 11px;
  color: var(--nm-text);
  white-space: nowrap;
}
.nm-snap-popup input[type=number] {
  width: 40px;
  text-align: center;
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(74, 74, 74, 0.20);
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 11px;
  color: var(--nm-text);
  outline: none;
  -moz-appearance: textfield;
}
.nm-snap-popup input[type=number]:focus {
  border-color: var(--nm-accent);
}
.nm-snap-popup input[type=number]::-webkit-inner-spin-button,
.nm-snap-popup input[type=number]::-webkit-outer-spin-button {
  opacity: 1;
}

/* ── Mask action popup ───────────────────────────────────── */
.nm-mask-popup,
.nm-gizmo-popup {
  align-items: center;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  background: rgba(248, 248, 245, 0.96);
  border: 1px solid rgba(74, 74, 74, 0.20);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.nm-mask-popup button,
.nm-gizmo-popup button {
  min-width: 112px;
  height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  background: var(--nm-fill);
  color: var(--nm-text-strong);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}
.nm-mask-popup button:hover,
.nm-gizmo-popup button:hover,
.nm-mask-popup button.nm-on,
.nm-gizmo-popup button.nm-on {
  background: var(--nm-accent);
  color: #ffffff;
}

.nm-mask-depth {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  width: 114px;
  padding: 2px 1px 0;
}
.nm-mask-depth-label {
  color: var(--nm-text);
  font-size: 11px;
  text-align: center;
}
.nm-mask-depth-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  margin: 6px 0;
  border-radius: 3px;
  background: var(--nm-fill);
  cursor: pointer;
}
.nm-mask-depth-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--nm-accent);
  border: 2px solid #ffffff;
  cursor: pointer;
}
.nm-mask-depth-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--nm-accent);
  border: 2px solid #ffffff;
  cursor: pointer;
}

.nm-mask-thickness-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  width: 114px;
  max-width: 114px;
  min-width: 0;
  padding: 2px 1px 0;
  box-sizing: border-box;
}

.nm-mask-thickness-panel > * {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.nm-mask-thickness-panel select {
  height: 24px;
  padding: 0 4px;
  border: 0;
  border-radius: 5px;
  background: var(--nm-fill);
  color: var(--nm-text-strong);
  font: inherit;
  font-size: 11px;
}

.nm-mask-thickness-panel button {
  min-width: 0;
}

.nm-mask-facegroup-swatches {
  display: grid;
  grid-template-columns: repeat(4, 24px);
  gap: 6px;
  width: 114px;
  justify-content: center;
  padding-top: 2px;
}

.nm-mask-facegroup-swatches[hidden] {
  display: none;
}

.nm-mask-popup .nm-mask-facegroup-swatch {
  min-width: 24px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid rgba(36, 36, 36, 0.22);
  border-radius: 5px;
  color: transparent;
}

.nm-mask-popup .nm-mask-facegroup-swatch:hover,
.nm-mask-popup .nm-mask-facegroup-swatch.nm-on {
  border-color: var(--nm-accent);
  box-shadow: inset 0 0 0 2px #ffffff;
}

.nm-mask-facegroup-empty {
  grid-column: 1 / -1;
  color: var(--nm-text);
  font-size: 11px;
  text-align: center;
}
