*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  /* Modals / floating panels (bake, auth, new document, library, etc.) */
  --trumble-popup-radius: 10px;
}

html,
body,
#root {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
  background-color: #262626;
  color: #dddddd;
  /* Dock tab strip: theme border tone (not panel fill) */
  --sidebar-dock-strip-bg: #404040;
}

.app-root {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: radial-gradient(circle at top left, #262626, #111111 60%);
  user-select: none;
  -webkit-user-select: none;
  /* Ad column (0–310px = 300px slot + 5px side gutters); thin #rightbar sits just to the left */
  /* Temporary hard-hide ad column for all tiers/users. */
  --ad-panel-width: 0px;
  --rightbar-width: 15px;
}

/* Force-hide ad panel regardless of JS state/tier; easy to revert later. */
#sponsor-panel {
  display: none !important;
}

/* Home tool: collapse ad column and hide the panel (still in DOM for other tools / AdSense) */
.app-root[data-current-tool="home"] {
  --ad-panel-width: 0px !important;
}

.app-root[data-current-tool="home"] #sponsor-panel {
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
  min-width: 0;
}

/* No visible selection highlight in the app (e.g. dropdown options, labels) */
.app-root::selection,
.app-root *::selection {
  background: transparent;
  color: inherit;
}

/* Allow text selection only where it’s useful (inputs, textareas) */
.app-root input[type="text"],
.app-root input[type="search"],
.app-root input[type="email"],
.app-root input[type="number"],
.app-root input:not([type]),
.app-root textarea,
.app-root [contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
}

/* Visible selection in inputs/textareas when user selects text */
.app-root input[type="text"]::selection,
.app-root input[type="search"]::selection,
.app-root input[type="email"]::selection,
.app-root input[type="number"]::selection,
.app-root input:not([type])::selection,
.app-root textarea::selection,
.app-root [contenteditable="true"]::selection {
  background: rgba(96, 165, 250, 0.35);
  color: inherit;
}

/* Scrollbars: match theme, no arrow buttons (slider only) */
* {
  scrollbar-width: thin;
  scrollbar-color: #525252 #2a2a2a;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

*::-webkit-scrollbar-track {
  background: #2a2a2a;
}

*::-webkit-scrollbar-thumb {
  background: #525252;
  border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
  background: #606060;
}

*::-webkit-scrollbar-corner {
  background: #2a2a2a;
}

body[data-theme="light"] * {
  scrollbar-color: #c0c0c0 #e8e8e8;
}

body[data-theme="light"] *::-webkit-scrollbar-track {
  background: #e8e8e8;
}

body[data-theme="light"] *::-webkit-scrollbar-thumb {
  background: #c0c0c0;
}

body[data-theme="light"] *::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

body[data-theme="light"] *::-webkit-scrollbar-corner {
  background: #e8e8e8;
}

/* Dock: add bar, slots (each with tabs + content), drop zones */
.dock-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dock-add-bar {
  flex-shrink: 0;
  padding: 4px 6px;
  /* Border-tone strip; uses --sidebar-dock-strip-bg */
  background: var(--sidebar-dock-strip-bg, #404040);
  /* Edge into panel body (#262626) — distinct from border-tone strip fill */
  border-bottom: 1px solid #262626;
  position: relative;
}
.dock-add-btn {
  padding: 4px 10px;
  font-size: 12px;
  background: #2a2a2a;
  border: 1px solid #404040;
  border-radius: 4px;
  color: #dddddd;
  cursor: pointer;
}
.dock-add-btn:hover {
  background: #333;
}
.dock-add-menu {
  position: absolute;
  top: 100%;
  left: 6px;
  margin-top: 2px;
  min-width: 120px;
  background: #262626;
  border: 1px solid #404040;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  z-index: 100;
  padding: 4px 0;
}
.dock-add-menu-item {
  display: block;
  width: 100%;
  padding: 6px 12px;
  text-align: left;
  font-size: 12px;
  color: #dddddd;
  background: transparent;
  border: none;
  cursor: pointer;
}
.dock-add-menu-item:hover {
  background: #333;
}

.dock-slots {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.dock-slot {
  flex: 1 1 0;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dock-slot-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  padding: 4px 4px 0;
  min-height: 28px;
  background: var(--sidebar-dock-strip-bg, #404040);
  border-bottom: 1px solid #262626;
  flex-shrink: 0;
}
.dock-slot-tabs.is-drag-over {
  outline: 2px dashed #6b8cff;
  outline-offset: -2px;
}
.dock-slot-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.dock-drop-zone {
  flex-shrink: 0;
  height: 8px;
  min-height: 8px;
  background: linear-gradient(to bottom, transparent 0, transparent 3px, #262626 3px, #262626 5px, transparent 5px);
  transition: background 0.15s;
  cursor: ns-resize;
}
.dock-drop-zone.is-drag-over {
  background: linear-gradient(to bottom, transparent 0, transparent 3px, #3a5aaf 3px, #3a5aaf 5px, transparent 5px);
}
body[data-theme="light"] .dock-drop-zone {
  background: linear-gradient(to bottom, transparent 0, transparent 3px, #fcfcfc 3px, #fcfcfc 5px, transparent 5px);
}

.dock-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 6px;
  /* Former active-tab color for inactive tabs */
  background: #333;
  border: 1px solid #404040;
  border-bottom: none;
  border-radius: 0;
  cursor: grab;
  font-size: 12px;
  color: #dddddd;
  user-select: none;
  max-width: 120px;
  min-width: 0;
}
.dock-tab:hover {
  background: #3a3a3a;
}
.dock-tab.is-active {
  /* Match .panel / dock content (#262626) so the tab reads as one with the panel body */
  background: #262626;
  color: #fff;
  border-bottom: 1px solid #404040;
  margin-bottom: -1px;
}
.dock-tab:active {
  cursor: grabbing;
}
.dock-tab.is-dragging {
  opacity: 0.6;
}
.dock-tab.is-drag-over {
  outline: 2px solid #6b8cff;
  outline-offset: 1px;
}
.dock-tab__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dock-tab__close {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  opacity: 0.7;
}
.dock-tab__close:hover {
  opacity: 1;
  background: rgba(255,255,255,0.15);
}

.dock-panel {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.dock-panel[hidden] {
  display: none;
}

/* Outliner (dock panel): material list */
.outliner-materials-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0.25rem 0;
}
.outliner-empty {
  padding: 8px 12px;
  font-size: 12px;
  color: #9ca3af;
}
.outliner-material {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  /* Restore taller row height */
  padding: 8px 10px;
  border-radius: 0;
  border: 0;
  background: transparent;
  color: #e5e7eb;
  font-size: 12px;
  cursor: pointer;
}
.outliner-material__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.outliner-material__toggle {
  flex-shrink: 0;
  margin-left: auto;
}
.outliner-material__toggle.layer-row-btn {
  width: 20px;
  height: 20px;
}
.outliner-material__toggle .ph-thin {
  font-size: 16px;
}
.outliner-material:hover {
  background: rgba(255, 255, 255, 0.04);
}
.outliner-material.is-active {
  background: rgba(255, 255, 255, 0.08);
}

.dock-panel--color .sidebar-content.dock-color-inline {
  padding: 0.6rem 0.9rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* Custom color picker (sat/bright + hue + swatch + RGB) */
.dock-panel--color .cp {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.cp-sat-bright {
  position: relative;
  width: 100%;
  height: 140px;
  border-radius: 6px;
  border: 1px solid #404040;
  cursor: none;
  overflow: hidden;
  background: linear-gradient(to bottom, transparent, black), linear-gradient(to right, white, red);
}
.dock-panel--color .cp-sat-bright {
  height: auto;
  flex: 1;
  min-height: 80px;
}
.dock-panel--color .cp-tools,
.dock-panel--color .cp-mode-wrap,
.dock-panel--color .dock-color-inline .paint-color-popover__row {
  flex-shrink: 0;
}
.dock-panel--color .paint-color-popover__row {
  margin-top: 7px;
  margin-bottom: 0;
}
.dock-panel--color .cp-mode-wrap {
  margin-top: 7px;
}
.dock-panel.dock-panel--color {
  overflow: hidden;
}
body[data-theme="light"] .cp-sat-bright {
  border-color: #ccc;
}
.cp-marker {
  position: absolute;
  width: 14px;
  height: 14px;
  left: 50%;
  top: 0;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
  pointer-events: none;
}

/* Plus cursor overlay for color pickers (dock + popups) */
.cp-plus-cursor {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transform: translate(-50%, -50%);
  color: #dddddd;
}
.cp-plus-cursor .ph-thin {
  font-size: 20px;
}
body[data-theme="light"] .cp-plus-cursor {
  color: #111111;
}
.cp-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.cp-eyedropper {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: 1px solid #404040;
  border-radius: 4px;
  background: #333;
  color: #ddd;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.cp-eyedropper .ph-eyedropper {
  font-size: 18px;
}
.cp-eyedropper:hover { background-color: #444; }
body[data-theme="light"] .cp-eyedropper {
  background-color: #f0f0f0;
  border-color: #ccc;
  color: #333;
}
.cp-swatch {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid #404040;
  background:
    linear-gradient(var(--dock-cp-swatch, rgba(0, 0, 0, 1)), var(--dock-cp-swatch, rgba(0, 0, 0, 1))),
    repeating-conic-gradient(#666 0% 25%, #4b5563 0% 50%) 50% / 8px 8px;
}
body[data-theme="light"] .cp-swatch {
  border-color: #ccc;
  background:
    linear-gradient(var(--dock-cp-swatch, rgba(0, 0, 0, 1)), var(--dock-cp-swatch, rgba(0, 0, 0, 1))),
    repeating-conic-gradient(#ccc 0% 25%, #e0e0e0 0% 50%) 50% / 8px 8px;
}
.cp-hue-wrap {
  flex: 1;
  min-width: 0;
}
.cp-hue {
  position: relative;
  width: 100%;
  height: 12px;
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}
.cp-hue-handle {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
  pointer-events: none;
}
.cp-mode-wrap {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cp-mode-values {
  display: flex;
  min-width: 0;
}
.cp-mode-group {
  display: flex;
  gap: 6px;
  width: 100%;
}
.cp-mode-group[hidden] {
  display: none !important;
}
.cp-hsl.cp-mode-group {
  display: flex;
}
.cp-hex-wrap.cp-mode-group {
  display: flex;
  align-items: stretch;
}
.cp-hex-wrap .cp-rgb-item {
  flex: 1;
  min-width: 0;
}
.cp-hex-wrap .cp-rgb-label {
  text-align: center;
}
.cp-hex-input-wrap {
  display: flex;
  align-items: stretch;
  width: 100%;
  height: 26px;
  border: 1px solid #404040;
  border-radius: 4px;
  background: #333;
  overflow: hidden;
  box-sizing: border-box;
}
.cp-hex-prefix {
  display: flex;
  align-items: center;
  padding: 0 6px 0 8px;
  font-size: 12px;
  color: #999;
  flex-shrink: 0;
}
.cp-hex-input-wrap .cp-hex-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  border-radius: 0;
  background: transparent;
  padding-left: 2px;
}
body[data-theme="light"] .cp-hex-input-wrap {
  background: #fff;
  border-color: #ccc;
}
body[data-theme="light"] .cp-hex-prefix {
  color: #666;
}
.cp-mode-select-row {
  display: flex;
  align-items: center;
  width: 100%;
}
.cp-mode-select-row .cp-mode-select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.cp-hex-input {
  width: 100%;
  height: 26px;
  padding: 4px 6px;
  font-size: 12px;
  line-height: 1;
  font-family: inherit;
  text-align: left;
  letter-spacing: 0.05em;
  border: 1px solid #404040;
  border-radius: 4px;
  background: #333;
  color: #ddd;
  box-sizing: border-box;
  max-width: none;
}
.cp-hex-input-wrap .cp-hex-input {
  text-align: center;
}
.cp-hex-input:focus,
.cp-hex-input-wrap .cp-hex-input:focus {
  outline: none;
  box-shadow: none;
}
.cp-hex-input::placeholder {
  color: #666;
}
body[data-theme="light"] .cp-hex-input {
  background: #fff;
  border-color: #ccc;
  color: #111;
}
.cp-mode-select {
  padding: 4px 20px 4px 8px;
  font-size: 12px;
  font-family: inherit;
  text-align: center;
  border: 1px solid #404040;
  border-radius: 4px;
  background: #333;
  color: #ddd;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23ddd' d='M2 4l3 3 3-3H2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}
.cp-mode-select:focus {
  outline: none;
  box-shadow: none;
}
body[data-theme="light"] .cp-mode-select {
  background-color: #fff;
  border-color: #ccc;
  color: #111;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23333' d='M2 4l3 3 3-3H2z'/%3E%3C/svg%3E");
}
.cp-rgb {
  display: flex;
  gap: 6px;
}
.cp-rgb-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.cp-rgb-input {
  width: 100%;
  height: 26px;
  max-width: 56px;
  padding: 4px 6px;
  font-size: 12px;
  line-height: 1;
  text-align: center;
  border: 1px solid #404040;
  border-radius: 4px;
  background: #333;
  color: #ddd;
  box-sizing: border-box;
  -moz-appearance: textfield;
  appearance: textfield;
}
.cp-rgb-input::-webkit-outer-spin-button,
.cp-rgb-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.cp-rgb-input:focus {
  outline: none;
  box-shadow: none;
}
body[data-theme="light"] .cp-rgb-input {
  background: #fff;
  border-color: #ccc;
  color: #111;
}
.cp-rgb-label {
  font-size: 12px;
  color: #999;
  text-align: center;
  min-height: 14px;
  line-height: 14px;
}
body[data-theme="light"] .cp-rgb-label { color: #666; }
.dock-color-inline .paint-color-popover__row {
  margin-top: 10px;
}

.dock-panel--document .dock-document-inline {
  padding: 0.6rem 0.9rem;
}
.dock-document-tool-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.dock-document-tool-panel[hidden] {
  display: none;
}
.dock-document-empty {
  font-size: 12px;
  color: #999;
  padding: 0.5rem 0;
}
body[data-theme="light"] .dock-document-empty {
  color: #666;
}
.dock-document-form .paint-color-popover__row {
  margin-top: 8px;
}

/* Dock Properties panel (toggle buttons) */
.dock-properties-tool-panel {
  padding: 0 0.75rem 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
/* No bottom margin on brush properties (texture + paint) */
#dock-properties-texture,
#dock-properties-paint {
  padding-bottom: 0;
}
.dock-properties-tool-panel[hidden] {
  display: none !important;
}
/* Ensure tool panels stay hidden when not active (ID rules would otherwise override [hidden]) */
#dock-properties-texture[hidden],
#dock-properties-paint[hidden] {
  display: none !important;
}
.dock-properties-mode-row {
  display: flex;
  width: 100%;
  padding: 0 0 6px 0;
}
.dock-properties-mode-label {
  display: block;
  width: 100%;
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  color: #dddddd;
  padding: 4px 0 0 0;
}
body[data-theme="light"] .dock-properties-mode-label {
  color: #111;
}
.dock-properties-mode-label--sub {
  margin-bottom: 4px;
}

#dock-properties-mask .dock-properties-mode-row--mask-label .dock-properties-mode-label--sub {
  margin: 0;
  padding-top: 0;
}

#dock-properties-mask .dock-properties-mode-row--mask-label,
#dock-properties-select .dock-properties-mode-row {
  padding: 0;
}

#dock-properties-mask .dock-properties-mode-row--mask-label .dock-properties-mode-label--sub,
#dock-properties-select-label {
  padding-top: 8px;
}

/* Hide top "Brush" mode label so preview sits flush at top of panel */
#dock-properties-texture > .dock-properties-mode-row {
  display: none;
}

/* For Brush label inside scroll: make spacing above/below match */
#dock-properties-brush .dock-brush-scroll .dock-properties-mode-row,
#dock-properties-eraser .dock-brush-scroll .dock-properties-mode-row {
  padding: 0;
}
#dock-properties-brush .dock-brush-scroll .dock-properties-mode-label--sub,
#dock-properties-eraser .dock-brush-scroll .dock-properties-mode-label--sub {
  padding-top: 8px;
  margin-bottom: 4px;
}
.dock-prop-separator {
  width: 100%;
  border-bottom: 1px solid #404040;
  margin: 8px 0 0 0;
}
.dock-prop-separator + .dock-properties-mode-row {
  padding-top: 2px;
}
/* Consistent label size and spacing in properties panel; normal weight, match options bar (11px) */
#dock-properties-brush .tr-slider-label,
#dock-properties-brush .tr-slider-value,
#dock-properties-paint-brush .tr-slider-label,
#dock-properties-paint-brush .tr-slider-value,
#dock-properties-fill .tr-slider-label,
#dock-properties-fill .tr-slider-value {
  font-size: 11px;
  font-weight: 400 !important;
}
.dock-properties-brush .dock-properties-list {
  margin-top: 2px;
}
body[data-theme="light"] .dock-prop-separator {
  border-bottom-color: #ccc;
}
.dock-properties-mode {
  display: flex;
  flex-direction: column;
}
.dock-properties-mode[hidden] {
  display: none !important;
}
.dock-properties-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Modifier tool panels: title row + typography match Brush / Fill properties */
[id^="dock-properties-modifier-"] .dock-properties-list > .dock-properties-mode-row {
  padding: 0;
}
[id^="dock-properties-modifier-"] .dock-properties-list > .dock-properties-mode-row .dock-properties-mode-label--sub {
  padding-top: 8px;
  margin-bottom: 4px;
}
[id^="dock-properties-modifier-"] .tr-slider-label,
[id^="dock-properties-modifier-"] .tr-slider-value {
  font-size: 11px;
  font-weight: 400 !important;
}
/* Standalone modifier toggles: one control, no nested slider-row frame */
.dock-prop-modifier-btn-row {
  width: 100%;
  box-sizing: border-box;
}
.dock-prop-modifier-btn-row .dock-prop-btn {
  width: 100%;
  margin: 0;
}

/* Select tool: Island | Mesh — one row, equal-width segmented choice */
.dock-select-mode-row {
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 6px;
}
.dock-select-mode-row .dock-prop-btn {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
}

/* Select tool: bottom instruction line — body text, not section label weight */
#dock-properties-select-hint {
  font-weight: 400;
}

/* Brush preview: only the canvas stretches to edges; size slider and pen pressure match buttons below */
.dock-brush-preview-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0;
}
.dock-brush-preview-wrap {
  width: calc(100% + 1.5rem);
  margin-left: -0.75rem;
  margin-right: -0.75rem;
  aspect-ratio: 2 / 1;
  min-height: 60px;
  max-height: 140px;
  background: #1f1f1f;
  border-radius: 0;
  border-bottom: 1px solid #404040;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}
body[data-theme="light"] .dock-brush-preview-wrap {
  background: #f2f2f2;
  border-bottom-color: #ccc;
}
.dock-brush-preview-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}
.dock-brush-preview-section .dock-brush-options-row {
  width: 100%;
  box-sizing: border-box;
}

.dock-brush-tip-alpha-row {
  margin-top: 0;
  width: 100%;
  box-sizing: border-box;
}
.dock-brush-tip-alpha-row .dock-prop-resource-drop.dock-doc-channel-map-btn {
  margin-bottom: 0;
}
.dock-brush-tip-alpha-row .dock-prop-resource-preview.dock-doc-channel-map-btn {
  cursor: pointer;
  margin-top: 0;
}
.dock-brush-tip-alpha-row .dock-prop-resource-preview .dock-doc-channel-map-btn-clear {
  cursor: pointer;
}
.dock-brush-tip-alpha-row #texture-brush-tip-alpha-resource,
.dock-brush-tip-alpha-row #texture-eraser-tip-alpha-resource {
  margin-top: 2px;
}
.dock-brush-preview-section .dock-brush-option-btn {
  width: 100%;
  margin: 0;
}

/* Make texture brush preview fixed and rest scrollable */
#dock-properties-brush,
#dock-properties-eraser {
  display: flex;
  flex-direction: column;
  max-height: 100%;
  min-height: 0;
}
#dock-properties-brush .dock-brush-preview-section,
#dock-properties-eraser .dock-brush-preview-section {
  flex-shrink: 0;
}
/* Scroller = stable viewport. Reserve scrollbar gutter to prevent hover-induced width changes. */
#dock-properties-brush .dock-brush-scroll,
#dock-properties-eraser .dock-brush-scroll,
#dock-properties-paint-brush .dock-brush-scroll,
#dock-properties-fill .dock-fill-scroll {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  align-self: stretch;
  /* Cancel .dock-properties-tool-panel horizontal padding so scrollbar sits flush with dock edge */
  width: calc(100% + 0.75rem);
  max-width: none;
  margin: 0;
  margin-right: -0.75rem;
  padding: 0;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior-y: contain;
}


/* Breakout + column layout live inside the scroller so width tracks the inset box, not calc(100% + …) on the scrollport. */
#dock-properties-brush .dock-brush-scroll-inner,
#dock-properties-eraser .dock-brush-scroll-inner,
#dock-properties-paint-brush .dock-brush-scroll-inner,
#dock-properties-fill .dock-brush-scroll-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  margin-left: -0.75rem;
  margin-right: -0.75rem;
  padding-left: 0.75rem;
  padding-right: 0;
  padding-bottom: 20px;
}

#dock-properties-fill .dock-brush-scroll-inner {
  padding-top: 0;
}

/* Paint brush panel: same layout and spacing as texture brush, preview flush to top */
#dock-properties-paint {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#dock-properties-paint-brush {
  display: flex;
  flex-direction: column;
  max-height: 100%;
  flex: 1 1 auto;
  min-height: 0;
}
#dock-properties-paint-brush .dock-brush-preview-section {
  flex-shrink: 0;
}
#dock-properties-paint-brush .dock-brush-scroll .dock-properties-mode-row {
  padding: 0;
}
#dock-properties-paint-brush .dock-brush-scroll .dock-properties-mode-label--sub {
  padding-top: 8px;
  margin-bottom: 4px;
}

/* For properties panel, let only inner brush/content areas scroll */
#dock-panel-properties {
  overflow: hidden;
}

.dock-prop-fill-projection-select {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.dock-prop-fill-projection-row .paint-context-menu__label {
  white-space: nowrap;
  flex: 0 0 auto;
}
.dock-prop-fill-projection-select:focus,
.dock-prop-fill-projection-select:focus-visible {
  outline: none;
  background: transparent;
}
.dock-prop-fill-projection-select option {
  background: #1f1f1f;
  color: #e5e7eb;
}
body[data-theme="light"] .dock-prop-fill-projection-select option {
  background: #f9fafb;
  color: #111827;
}

.dock-prop-fill-tiling-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}
.dock-prop-fill-tiling-row .dock-prop-fill-slider-wrap {
  flex: 1;
  min-width: 0;
}
.dock-prop-fill-lock-btn {
  flex-shrink: 0;
  width: 26px;
  height: 100%;
  min-height: 22px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #dddddd;
  background: #1f1f1f;
  border: 1px solid #404040;
  border-radius: 4px;
  cursor: pointer;
}
.dock-prop-fill-lock-btn:hover {
  background: #404040;
}
.dock-prop-fill-lock-btn[aria-pressed="true"] {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(96, 165, 250, 0.18);
  color: #eaf2ff;
}
body[data-theme="light"] .dock-prop-fill-lock-btn {
  color: #111;
  background: #f2f2f2;
  border-color: #ccc;
}
body[data-theme="light"] .dock-prop-fill-lock-btn:hover {
  background: #e8e8e8;
}
body[data-theme="light"] .dock-prop-fill-lock-btn[aria-pressed="true"] {
  border-color: rgba(59, 130, 246, 0.55);
  background: rgba(59, 130, 246, 0.14);
  color: #0b1220;
}
.dock-prop-fill-tiling-row .tr-slider-label {
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
}
/* Value right-aligned with spacing: match Rotation/Offset (number toward right edge, not touching label) */
.dock-prop-fill-tiling-row .tr-slider-value {
  min-width: 32px;
  flex-shrink: 0;
  text-align: right;
  padding-left: 8px;
  padding-right: 0px;
  box-sizing: border-box;
}
/* Match Rotation row: same label distance from left as standalone slider rows */
.dock-prop-fill-tiling-row .tr-slider-row {
  padding: 2px 8px;
}
.dock-prop-fill-offset-row {
  display: flex;
  gap: 8px;
  width: 100%;
}
.dock-prop-fill-offset-row .dock-prop-fill-slider-wrap {
  flex: 1;
  min-width: 0;
}
/* Keep "Offset X" and "Offset Y" on one line */
.dock-prop-fill-offset-row .tr-slider-label {
  white-space: nowrap;
}
.dock-prop-fill-offset-row .tr-slider-row {
  padding: 2px 8px;
}
.dock-prop-fill-slider-wrap {
  width: 100%;
}

/* Fill panel: scrollable section so it doesn't push brush/other properties */
#dock-properties-fill {
  display: flex;
  flex-direction: column;
  max-height: 100%;
  min-height: 0;
}
#dock-properties-fill .dock-fill-scroll .dock-properties-mode-row {
  padding: 0;
}
#dock-properties-fill .dock-fill-scroll .dock-properties-mode-label--sub {
  padding-top: 8px;
  margin-bottom: 4px;
}
#dock-properties-fill .dock-fill-scroll .dock-properties-list {
  margin-top: 0;
}

/* Fill panel sliders: match options/brush panel styling (visible track, label, value) */
#dock-properties-fill .tr-slider-row.dock-prop-fill-slider-wrap,
#dock-properties-fill .dock-prop-fill-tiling-row .tr-slider-row,
#dock-properties-fill .dock-prop-fill-offset-row .tr-slider-row {
  border-radius: 4px;
  border: 1px solid #404040;
  background:
    linear-gradient(
      to right,
      #333333 0,
      #333333 var(--tr-slider-fill, 0%),
      #1f1f1f var(--tr-slider-fill, 0%),
      #1f1f1f 100%
    );
  color: #e5e7eb;
}
#dock-properties-fill .tr-slider-row.dock-prop-fill-slider-wrap .tr-slider-label,
#dock-properties-fill .tr-slider-row.dock-prop-fill-slider-wrap .tr-slider-value,
#dock-properties-fill .dock-prop-fill-tiling-row .tr-slider-label,
#dock-properties-fill .dock-prop-fill-tiling-row .tr-slider-value,
#dock-properties-fill .dock-prop-fill-offset-row .tr-slider-label,
#dock-properties-fill .dock-prop-fill-offset-row .tr-slider-value {
  color: inherit;
}
body[data-theme="light"] #dock-properties-fill .tr-slider-row.dock-prop-fill-slider-wrap,
body[data-theme="light"] #dock-properties-fill .dock-prop-fill-tiling-row .tr-slider-row,
body[data-theme="light"] #dock-properties-fill .dock-prop-fill-offset-row .tr-slider-row {
  background:
    linear-gradient(
      to right,
      #60A5FA 0,
      #60A5FA var(--tr-slider-fill, 0%),
      #FFFFFF var(--tr-slider-fill, 0%),
      #FFFFFF 100%
    );
  color: #111827;
}

/* Display panel: same look as Fill Properties (projection dropdown + sliders), full width */
#dock-panel-display .dock-properties-list {
  width: 100%;
}
#dock-panel-display .sidebar-content {
  width: 100%;
  padding: 0.45rem 0.75rem 0.75rem;
}
#dock-panel-display .tr-slider-row.dock-prop-fill-projection-row,
#dock-panel-display .tr-slider-row.dock-prop-fill-slider-wrap {
  width: 100%;
}

.dock-display-background-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.dock-display-background-label {
  font-size: 12px;
  color: #9ca3af;
}
body[data-theme="light"] .dock-display-background-label {
  color: #6b7280;
}
.dock-display-background-btns {
  display: flex;
  gap: 8px;
  width: 100%;
}
.dock-display-background-btns .dock-prop-btn {
  flex: 1;
  min-width: 0;
}
#dock-panel-display .tr-slider-row.dock-prop-fill-slider-wrap {
  border-radius: 4px;
  border: 1px solid #404040;
  background:
    linear-gradient(
      to right,
      #333333 0,
      #333333 var(--tr-slider-fill, 0%),
      #1f1f1f var(--tr-slider-fill, 0%),
      #1f1f1f 100%
    );
  color: #e5e7eb;
}
#dock-panel-display .tr-slider-row.dock-prop-fill-slider-wrap .tr-slider-label,
#dock-panel-display .tr-slider-row.dock-prop-fill-slider-wrap .tr-slider-value {
  color: inherit;
}
body[data-theme="light"] #dock-panel-display .tr-slider-row.dock-prop-fill-slider-wrap {
  background:
    linear-gradient(
      to right,
      #60A5FA 0,
      #60A5FA var(--tr-slider-fill, 0%),
      #FFFFFF var(--tr-slider-fill, 0%),
      #FFFFFF 100%
    );
  color: #111827;
}

.dock-prop-section {
  width: 100%;
}
.dock-prop-section--color {
  width: 100%;
}
.dock-prop-section--metallic {
  width: 100%;
}
.dock-prop-section--normal {
  width: 100%;
}
.dock-prop-section--height {
  width: 100%;
}
.dock-prop-section--emissive {
  width: 100%;
}
.dock-prop-section--opacity {
  width: 100%;
}

#dock-properties-mask .dock-prop-section--grayscale {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#dock-properties-mask .dock-prop-section--grayscale .dock-prop-btn {
  width: 100%;
  margin: 0;
}
#dock-properties-mask .dock-mask-image-adjust-row {
  width: 100%;
}
#dock-properties-mask .dock-mask-image-adjust-row .tr-slider-row {
  width: 100%;
}

.dock-prop-metallic-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}
.dock-prop-metallic-value {
  min-width: 36px;
  text-align: right;
  color: #9ca3af;
}
.dock-prop-metallic-input {
  font-size: 11px;
  font-family: inherit;
  color: #e5e7eb;
  background: transparent;
  border: 1px solid #404040;
  border-radius: 3px;
  padding: 0 2px;
  box-sizing: border-box;
  text-align: right;
  height: 16px;
  line-height: 16px;
}
.dock-prop-metallic-input:focus {
  outline: none;
  box-shadow: none;
}
.dock-prop-color-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dock-prop-color-row[hidden],
.dock-prop-resource-drop[hidden],
.dock-prop-metallic-row[hidden] {
  display: none !important;
}
.dock-prop-btn {
  width: 100%;
  height: 26px;
  padding: 0 12px;
  font-size: 12px;
  line-height: 1.2;
  font-family: inherit;
  border: 1px solid #404040;
  border-radius: 4px;
  background: #1f1f1f;
  color: #dddddd;
  cursor: pointer;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex-shrink: 0;
}
.dock-prop-btn:hover {
  background: #262626;
}
.dock-prop-btn:active {
  background: #303030;
}
.dock-prop-btn.is-on {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(96, 165, 250, 0.18);
  color: #eaf2ff;
}
body[data-theme="light"] .dock-prop-btn {
  border-color: #ccc;
  background: #f2f2f2;
  color: #111;
}
body[data-theme="light"] .dock-prop-btn:hover {
  background: #e8e8e8;
}
body[data-theme="light"] .dock-prop-btn.is-on {
  border-color: rgba(59, 130, 246, 0.55);
  background: rgba(59, 130, 246, 0.14);
  color: #0b1220;
}
.dock-prop-color-btn {
  flex: 1 1 auto;
  height: 26px;
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  border-color: #404040;
  padding: 0;
  box-sizing: border-box;
}
.dock-prop-color-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
body[data-theme="light"] .dock-prop-color-btn {
  border-color: #ccc;
}
.dock-prop-eyedropper-btn {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: 1px solid #404040;
  background: #1f1f1f;
  color: #e5e7eb;
  cursor: pointer;
  flex-shrink: 0;
  box-sizing: border-box;
}

.dock-prop-color-btn:focus,
.dock-prop-color-btn:focus-visible,
.dock-prop-eyedropper-btn:focus,
.dock-prop-eyedropper-btn:focus-visible {
  outline: none;
  box-shadow: none;
}
.dock-prop-eyedropper-btn:hover {
  background: #262626;
}
.dock-prop-eyedropper-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
body[data-theme="light"] .dock-prop-eyedropper-btn {
  border-color: #ccc;
  background: #f2f2f2;
  color: #111;
}

.dock-prop-resource-drop {
  width: 100%;
  height: 26px;
  margin-top: 6px;
  padding: 0 12px;
  font-size: 12px;
  font-family: inherit;
  border: 1px dashed currentColor;
  border-radius: 4px;
  background: #262626;
  color: #dddddd;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  text-align: center;
}
body[data-theme="light"] .dock-prop-resource-drop {
  background: #f2f2f2;
  color: #111;
}

.dock-prop-resource-preview {
  display: flex;
  width: 100%;
  margin-top: 0;
  gap: 8px;
}
.dock-prop-resource-preview[hidden] {
  display: none !important;
}
.dock-prop-resource-preview__left {
  flex: 0 0 33.333%;
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 4px;
  overflow: hidden;
  background: #262626;
  border: 1px solid #404040;
  padding: 6px;
  box-sizing: border-box;
  color: #dddddd;
  cursor: pointer;
  position: relative;
}
body[data-theme="light"] .dock-prop-resource-preview__left {
  color: #111;
  border-color: #ccc;
}
.dock-prop-resource-preview__close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 16px;
  height: 16px;
  background: #262626;
  color: inherit;
  font-size: 12px;
  line-height: 12px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  border-radius: 1px;
}
.dock-prop-resource-preview__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 2px;
}
.dock-prop-resource-preview__right {
  flex: 1;
  min-width: 0;
}

.dock-prop-color-resource-adjust {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  justify-content: flex-start;
}
.dock-prop-btn--compact {
  height: 22px;
  padding: 0 8px;
  font-size: 11px;
}
.dock-prop-color-resource-adjust > .dock-prop-color-btn.dock-prop-color-btn--tint {
  flex: 0 0 auto;
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 26px;
  display: flex;
}
.dock-prop-color-resource-adjust .dock-prop-color-resource-levels-row {
  margin: 0;
  width: 100%;
}
.dock-prop-color-resource-adjust .dock-prop-color-resource-levels-row .tr-slider-input {
  min-width: 0;
}
.dock-prop-color-resource-adjust .dock-prop-metallic-resource-levels-row {
  margin: 0;
  width: 100%;
}
.dock-prop-color-resource-adjust .dock-prop-metallic-resource-levels-row .tr-slider-input {
  min-width: 0;
}
.dock-prop-color-resource-adjust .dock-prop-roughness-resource-levels-row {
  margin: 0;
  width: 100%;
}
.dock-prop-color-resource-adjust .dock-prop-roughness-resource-levels-row .tr-slider-input {
  min-width: 0;
}
.dock-prop-color-resource-adjust .dock-prop-ao-resource-levels-row {
  margin: 0;
  width: 100%;
}
.dock-prop-color-resource-adjust .dock-prop-ao-resource-levels-row .tr-slider-input {
  min-width: 0;
}
.dock-prop-color-resource-adjust .dock-prop-height-resource-levels-row {
  margin: 0;
  width: 100%;
}
.dock-prop-color-resource-adjust .dock-prop-height-resource-levels-row .tr-slider-input {
  min-width: 0;
}
.dock-prop-color-resource-adjust .dock-prop-opacity-resource-levels-row {
  margin: 0;
  width: 100%;
}
.dock-prop-color-resource-adjust .dock-prop-opacity-resource-levels-row .tr-slider-input {
  min-width: 0;
}
.dock-prop-color-resource-adjust .dock-prop-normal-resource-levels-row {
  margin: 0;
  width: 100%;
}
.dock-prop-color-resource-adjust .dock-prop-normal-resource-levels-row .tr-slider-input {
  min-width: 0;
}

.dock-prop-resource-image-params {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}
.dock-prop-resource-image-params .dock-prop-metallic-resource-levels-row {
  margin: 0;
  width: 100%;
}
.dock-prop-resource-image-params .dock-prop-metallic-resource-levels-row .tr-slider-input {
  min-width: 0;
}
.dock-prop-resource-preview__left--stack {
  display: flex;
  flex-direction: column;
}
.dock-prop-resource-preview__left--stack .dock-prop-resource-preview__img-stack {
  flex: 1;
  min-height: 0;
  position: relative;
  width: 100%;
}
.dock-prop-resource-preview__img-stack {
  position: relative;
  width: 100%;
  min-height: 0;
}
.dock-prop-resource-preview__img-stack .dock-prop-resource-preview__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 2px;
}
.dock-prop-resource-preview__multiply-tint {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 2px;
  mix-blend-mode: multiply;
  display: none;
  background: #ffffff;
}
.dock-prop-resource-preview__multiply-tint.is-visible {
  display: block;
}
.dock-prop-resource-preview__img.dock-prop-resource-preview__img--grayscale {
  filter: grayscale(1);
}

.dock-doc-input,
.dock-doc-select {
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid #404040;
  border-radius: 4px;
  background: #333;
  color: #ddd;
  min-width: 0;
}
.dock-doc-input {
  flex: 1;
}
.dock-doc-number {
  width: 72px;
}
.dock-doc-select {
  flex: 1;
  cursor: pointer;
}
body[data-theme="light"] .dock-doc-input,
body[data-theme="light"] .dock-doc-select {
  background: #fff;
  border-color: #ccc;
  color: #111;
}
.dock-doc-select:disabled {
  opacity: 0.8;
  cursor: default;
}
.dock-doc-texture-model-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.dock-doc-texture-model-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #aaa;
}
body[data-theme="light"] .dock-doc-texture-model-name {
  color: #555;
}
.dock-doc-btn {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid #505050;
  border-radius: 4px;
  background: #404040;
  color: #ddd;
  cursor: pointer;
}
.dock-doc-btn:hover {
  background: #505050;
}
.dock-doc-btn--small {
  padding: 2px 8px;
  font-size: 11px;
  flex-shrink: 0;
}
.dock-doc-channel-maps-label {
  margin-top: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #dddddd;
}
.dock-document-tool-panel .paint-color-popover__title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #dddddd;
}
#dock-document-texture-form {
  margin-top: 8px;
}
#dock-document-texture-form .paint-color-popover__row:first-child {
  margin-top: 0;
}
#dock-doc-texture-name,
#dock-doc-texture-size {
  width: 100%;
}
.dock-doc-channel-maps-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.dock-doc-channel-map-btn {
  width: 100%;
  min-height: 28px;
  padding: 5px 8px;
  border: 1px dashed currentColor;
  border-radius: 4px;
  background: #262626;
  color: #cfcfcf;
  font-size: 12px;
  text-align: center;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
}
.dock-doc-channel-map-btn:hover {
  background: #2f2f2f;
}
.dock-doc-channel-map-btn.has-image {
  justify-content: flex-start;
  border-style: solid;
  border-color: #404040;
}
.dock-doc-channel-map-btn.has-image {
  color: #f0f0f0;
}
body[data-theme="light"] .dock-doc-channel-map-btn.has-image {
  border-color: #ccc;
}
.dock-doc-channel-map-thumb {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  border: 1px solid currentColor;
  object-fit: cover;
  flex-shrink: 0;
}
.dock-doc-channel-map-btn-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.dock-doc-channel-map-btn-clear {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  padding: 0;
  margin-left: 4px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.dock-doc-channel-map-btn-clear:hover {
  background: #404040;
  color: #ef4444;
}

body[data-theme="light"] .dock-doc-channel-map-btn-clear:hover {
  background: #e5e7eb;
  color: #dc2626;
}

body[data-theme="light"] .dock-doc-btn {
  border-color: #ccc;
  background: #e8e8e8;
  color: #111;
}
body[data-theme="light"] .dock-doc-btn:hover {
  background: #ddd;
}
body[data-theme="light"] .dock-doc-channel-maps-label {
  color: #111;
}
body[data-theme="light"] .dock-document-tool-panel .paint-color-popover__title {
  color: #111;
}
body[data-theme="light"] .dock-doc-channel-map-btn {
  background: #fff;
  color: #111;
}
body[data-theme="light"] .dock-doc-channel-map-btn:hover {
  background: #f3f3f3;
}

.workspace {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, #404040 0, #262626 55%);
  min-width: 0;
  min-height: 0;
  z-index: 0;
}

.app-root[data-current-tool="home"],
.app-root[data-current-tool="paint"],
.app-root[data-current-tool="vector"],
.app-root[data-current-tool="texture"],
.app-root[data-current-tool="trim"],
.app-root[data-current-tool="bake"] {
  background: #262626;
}

.app-root[data-current-tool="home"] .workspace,
.app-root[data-current-tool="paint"] .workspace,
.app-root[data-current-tool="vector"] .workspace,
.app-root[data-current-tool="texture"] .workspace,
.app-root[data-current-tool="trim"] .workspace,
.app-root[data-current-tool="bake"] .workspace {
  background: #262626;
}

body[data-theme="light"] .app-root[data-current-tool="home"],
body[data-theme="light"] .app-root[data-current-tool="paint"],
body[data-theme="light"] .app-root[data-current-tool="vector"],
body[data-theme="light"] .app-root[data-current-tool="texture"],
body[data-theme="light"] .app-root[data-current-tool="trim"],
body[data-theme="light"] .app-root[data-current-tool="bake"] {
  background: #fcfcfc;
}

body[data-theme="light"] .app-root[data-current-tool="home"] .workspace,
body[data-theme="light"] .app-root[data-current-tool="paint"] .workspace,
body[data-theme="light"] .app-root[data-current-tool="vector"] .workspace,
body[data-theme="light"] .app-root[data-current-tool="texture"] .workspace,
body[data-theme="light"] .app-root[data-current-tool="trim"] .workspace,
body[data-theme="light"] .app-root[data-current-tool="bake"] .workspace {
  background: #fcfcfc;
}

.workspace-content {
  position: absolute;
  inset: 0;
  display: none;
}

.vector-canvas-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
  background: #ffffff;
  border: 1px solid #404040;
  border-radius: 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.vector-canvas {
  display: block;
  background: transparent;
}

body[data-theme="light"] .vector-canvas-wrapper {
  border-color: #e8e8e8;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

/* Vector new document: make name field stretch full width of dialog */
#vector-new-name.paint-new-form__input {
  max-width: 100%;
}

/* Vector new document: make preset dropdown stretch full width */
#vector-new-preset.paint-new-form__input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.app-root[data-current-tool="home"] #workspace-home {
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}

.app-root[data-current-tool="retopology"] #workspace-retopology,
.app-root[data-current-tool="texture"] #workspace-texture,
.app-root[data-current-tool="trim"] #workspace-trim,
.app-root[data-current-tool="bake"] #workspace-bake,
.app-root[data-current-tool="vector"] #workspace-vector,
.app-root[data-current-tool="paint"] #workspace-paint {
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-panel {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  box-sizing: border-box;
  padding: 24px;
  color: inherit;
  user-select: text;
  -webkit-user-select: text;
}

/* Home: #workspace is full-bleed under the menu bar, left toolbar, and status bar — pad so content clears.
   Privacy/About/Contact are siblings of .home-page — share tokens + same centered column as marketing. */
.app-root[data-current-tool="home"] .home-panel {
  --trumble-menu-bar-height: 40px;
  --trumble-toolbar-width: 40px;
  --trumble-status-bar-height: 32px;

  padding-top: calc(var(--trumble-menu-bar-height) + 24px);
  padding-left: calc(var(--trumble-toolbar-width) + 24px);
  padding-right: 24px;
  padding-bottom: calc(var(--trumble-status-bar-height) + 24px);
  scroll-padding-top: calc(var(--trumble-menu-bar-height) + 8px);
  scroll-padding-left: var(--trumble-toolbar-width);
  scroll-padding-bottom: calc(var(--trumble-status-bar-height) + 8px);

  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --home-accent: #60a5fa;
  --home-accent-hover: #3b82f6;
  --home-accent-surface: rgba(96, 165, 250, 0.22);
  --home-accent-surface-soft: rgba(96, 165, 250, 0.16);
  --home-on-accent: #f8fafc;
  --color-text-primary: #f5f5f5;
  --color-text-secondary: #a3a3a3;
  --color-background-primary: #2a2a2a;
  --color-background-secondary: #262626;
  --color-background-tertiary: #333333;
  --color-border-secondary: #525252;
  --color-border-tertiary: #404040;
  --border-radius-md: 6px;
  --border-radius-lg: 10px;
}

.app-root[data-current-tool="home"] .home-panel > .home-page,
.app-root[data-current-tool="home"] .home-panel > .home-static-page {
  width: 100%;
  max-width: 920px;
  margin-left: 0;
  margin-right: 0;
  box-sizing: border-box;
  flex-shrink: 0;
}

body[data-theme="light"] .app-root[data-current-tool="home"] .home-panel {
  --home-accent: #2563eb;
  --home-accent-hover: #1d4ed8;
  --home-accent-surface: #dbeafe;
  --home-accent-surface-soft: rgba(37, 99, 235, 0.12);
  --color-text-primary: #171717;
  --color-text-secondary: #525252;
  --color-background-primary: #fafafa;
  --color-background-secondary: #f4f4f5;
  --color-background-tertiary: #e4e4e7;
  --color-border-secondary: #a1a1aa;
  --color-border-tertiary: #d4d4d8;
}

/* Privacy / About / Contact (home tool only) — width/centering from .home-panel flex + rule above */
.home-static-page {
  max-width: 920px;
  margin: 0;
  padding: 0 0 3rem;
  font-size: 14px;
  line-height: 1.65;
  font-family: var(--font-sans, system-ui, sans-serif);
  color: var(--color-text-primary);
}

.home-static-page__back {
  display: inline-flex;
  align-items: center;
  margin: 0 0 1.25rem;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--color-text-secondary);
  background: transparent;
  border: 1px solid var(--color-border-tertiary);
  border-radius: 6px;
  cursor: pointer;
}

.home-static-page__back:hover {
  color: var(--color-text-primary);
  border-color: var(--color-border-secondary);
}

.home-static-page__title {
  font-size: 1.75rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  line-height: 1.25;
}

.home-static-page__meta {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin: 0 0 1.25rem;
}

.home-static-page h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
  color: var(--color-text-primary);
}

.home-static-page p {
  margin: 0 0 1rem;
  color: var(--color-text-secondary);
}

.home-static-page ul {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
  color: var(--color-text-secondary);
}

.home-static-page li {
  margin-bottom: 0.5rem;
}

.home-static-page a {
  color: var(--home-accent);
  text-decoration: none;
}

.home-static-page a:hover {
  text-decoration: underline;
}

.home-static-page__note {
  font-size: 13px;
  font-style: italic;
}

/* ——— Home landing (Textura-style marketing; scoped to .home-page) ——— */
.home-page {
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  /* Match app chrome accent (see sliders, focus rings, dock — #60a5fa) */
  --home-accent: #60a5fa;
  --home-accent-hover: #3b82f6;
  --home-accent-surface: rgba(96, 165, 250, 0.22);
  --home-accent-surface-soft: rgba(96, 165, 250, 0.16);
  --home-on-accent: #f8fafc;
  --color-text-primary: #f5f5f5;
  --color-text-secondary: #a3a3a3;
  --color-background-primary: #2a2a2a;
  --color-background-secondary: #262626;
  --color-background-tertiary: #333333;
  --color-border-secondary: #525252;
  --color-border-tertiary: #404040;
  --border-radius-md: 6px;
  --border-radius-lg: 10px;

  max-width: 920px;
  margin: 0 auto;
  padding-bottom: 32px;
  font-family: var(--font-sans);
}

.home-page *,
.home-page *::before,
.home-page *::after {
  box-sizing: border-box;
}

.home-page .hero {
  padding: 2.5rem 1.5rem 2rem;
  text-align: center;
  border-bottom: 0.5px solid var(--color-border-tertiary);
}

.home-page .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-background-primary);
  border: 0.5px solid var(--color-border-secondary);
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-bottom: 1.5rem;
}

.home-page .badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1d9e75;
}

.home-page h1 {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 500;
  color: var(--color-text-primary);
  line-height: 1.15;
  margin: 0 0 1rem;
  letter-spacing: -0.5px;
}

.home-page h1 span {
  color: var(--home-accent);
}

.home-page .hero-sub {
  font-size: 16px;
  color: var(--color-text-secondary);
  max-width: 560px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.home-page .cta-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.home-page .btn-primary {
  background: var(--home-accent);
  color: var(--home-on-accent);
  border: none;
  padding: 10px 22px;
  border-radius: var(--border-radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 0.15s ease;
}

.home-page .btn-primary:hover {
  background: var(--home-accent-hover);
}

.home-page .btn-outline {
  background: transparent;
  color: var(--color-text-primary);
  border: 0.5px solid var(--color-border-secondary);
  padding: 10px 22px;
  border-radius: var(--border-radius-md);
  font-size: 14px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.home-page .btn-outline:hover {
  background: var(--color-background-primary);
}

.home-page .platforms {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.home-page .platform-chip {
  display: flex;
  align-items: center;
  gap: 5px;
}

.home-page .check {
  color: #1d9e75;
  font-size: 13px;
}

.home-page .app-preview {
  margin: 2.5rem auto 0;
  max-width: 680px;
  background: var(--color-background-primary);
  border: 0.5px solid var(--color-border-tertiary);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
}

.home-page .app-preview__img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

.home-page .section {
  padding: 3rem 1.5rem;
}

.home-page .section-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--home-accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
  margin-bottom: 0.5rem;
}

.home-page .section-title {
  font-size: 26px;
  font-weight: 500;
  text-align: center;
  color: var(--color-text-primary);
  margin-bottom: 0.5rem;
}

.home-page .section-sub {
  font-size: 15px;
  color: var(--color-text-secondary);
  text-align: center;
  max-width: 480px;
  margin: 0 auto 2.5rem;
  line-height: 1.6;
}

.home-page .tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  max-width: 860px;
  margin: 0 auto;
}

.home-page .tool-card {
  background: var(--color-background-primary);
  border: 0.5px solid var(--color-border-tertiary);
  border-radius: var(--border-radius-lg);
  padding: 1.25rem;
}

.home-page button.tool-card.tool-card--action {
  cursor: pointer;
  font: inherit;
  text-align: left;
  width: 100%;
  color: inherit;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.home-page button.tool-card.tool-card--action:hover {
  border-color: rgba(96, 165, 250, 0.5);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.22);
}

.home-page .tool-card--roadmap {
  border-style: dashed;
}

.home-page .tool-icon-lg {
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 18px;
}

.home-page .tool-icon-lg--accent {
  background: var(--home-accent-surface);
}

.home-page .tool-icon-lg--menu {
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-page .tool-icon-lg--menu .ph-thin {
  font-size: 22px;
  line-height: 1;
  color: var(--color-text-primary);
}

.home-page .tool-icon-lg--texture {
  background: var(--home-accent-surface);
}

.home-page .tool-icon-lg--texture .ph-thin {
  color: var(--home-accent);
}

.home-page .tool-icon-lg--paint {
  background: rgba(29, 158, 117, 0.18);
}

.home-page .tool-icon-lg--paint .ph-thin {
  color: #1d9e75;
}

.home-page .tool-icon-lg--bake {
  background: rgba(248, 153, 123, 0.2);
}

.home-page .tool-icon-lg--bake .ph-thin {
  color: #ea580c;
}

.home-page .tool-icon-lg--roadmap {
  background: var(--color-background-secondary);
}

body[data-theme="light"] .home-page .tool-icon-lg--paint .ph-thin {
  color: #047857;
}

body[data-theme="light"] .home-page .tool-icon-lg--bake .ph-thin {
  color: #c2410c;
}

.home-page .tool-card h3 {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-primary);
  margin: 0 0 6px;
}

.home-page .tool-card p {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin: 0;
}

.home-page .coming-soon {
  font-size: 11px;
  font-weight: 500;
  color: var(--home-accent);
  background: var(--home-accent-surface-soft);
  border-radius: 99px;
  padding: 2px 8px;
  display: inline-block;
  margin-top: 8px;
}

.home-page .pricing {
  padding: 3rem 1.5rem;
  background: var(--color-background-secondary);
  border-top: 0.5px solid var(--color-border-tertiary);
  border-bottom: 0.5px solid var(--color-border-tertiary);
}

.home-page .pricing-separator {
  height: 1px;
  margin: 0 1.5rem;
  background: var(--color-border-tertiary);
}

.home-page .pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  max-width: 680px;
  margin: 0 auto;
}

.home-page .price-card {
  background: var(--color-background-primary);
  border: 0.5px solid var(--color-border-tertiary);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
}

.home-page .price-card.featured {
  border: 2px solid var(--home-accent);
}

.home-page .featured-badge {
  font-size: 11px;
  font-weight: 500;
  color: var(--home-accent);
  background: var(--home-accent-surface-soft);
  border-radius: 99px;
  padding: 3px 10px;
  display: inline-block;
  margin-bottom: 10px;
}

.home-page .price-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--color-text-primary);
  margin-bottom: 4px;
}

.home-page .price-amount {
  font-size: 30px;
  font-weight: 500;
  color: var(--color-text-primary);
  margin: 8px 0 4px;
}

.home-page .price-amount span {
  font-size: 14px;
  font-weight: 400;
  color: var(--color-text-secondary);
}

.home-page .price-desc {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.home-page .price-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.home-page .price-features li {
  font-size: 13px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.home-page .price-features li .check {
  font-size: 12px;
}

.home-page .footer-cta {
  padding: 3rem 1.5rem;
  text-align: center;
}

.home-page .footer-cta h2 {
  font-size: 24px;
  font-weight: 500;
  color: var(--color-text-primary);
  margin: 0 0 0.5rem;
}

.home-page .footer-cta p {
  font-size: 15px;
  color: var(--color-text-secondary);
  margin: 0 0 1.5rem;
}

.home-page .footer {
  padding: 1.5rem 1.5rem;
  border-top: 0.5px solid var(--color-border-tertiary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.home-page .footer-logo {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-primary);
}

.home-page .footer-logo span {
  color: var(--home-accent);
}

.home-page .footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.home-page .footer-links a {
  font-size: 12px;
  color: var(--color-text-secondary);
  text-decoration: none;
}

.home-page .footer-links a:hover {
  color: var(--color-text-primary);
  text-decoration: underline;
}

/* Light theme: home marketing */
body[data-theme="light"] .home-page {
  --home-accent: #2563eb;
  --home-accent-hover: #1d4ed8;
  --home-accent-surface: #dbeafe;
  --home-accent-surface-soft: rgba(37, 99, 235, 0.12);
  --color-text-primary: #171717;
  --color-text-secondary: #525252;
  --color-background-primary: #fafafa;
  --color-background-secondary: #f4f4f5;
  --color-background-tertiary: #e4e4e7;
  --color-border-secondary: #a1a1aa;
  --color-border-tertiary: #d4d4d8;
}

body[data-theme="light"] .home-page .coming-soon {
  background: var(--home-accent-surface);
  color: var(--home-accent);
}

body[data-theme="light"] .home-page .featured-badge {
  background: var(--home-accent-surface);
  color: var(--home-accent);
}

/* Paint: HTML/CSS contenteditable overlay while editing text (plain text → Konva.Text on commit). */
.paint-html-text-editor {
  white-space: pre-wrap;
  word-break: break-word;
  cursor: text;
  -webkit-font-smoothing: antialiased;
}

.tt-workspace {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.5fr) 2px minmax(0, 0.5fr);
  gap: 0;
  padding:
    var(--tt-top-inset, 80px)
    var(--tt-right-inset, 275px)
    var(--tt-bottom-inset, 40px)
    var(--tt-left-inset, 48px);
}

.tt-pane {
  position: relative;
  border: none;
  background: #262626;
  border-radius: 0;
  overflow: hidden;
}

.tt-split-handle {
  position: relative;
  align-self: stretch;
  cursor: col-resize;
}

.tt-split-handle::before {
  content: "";
  position: absolute;
  inset: 0;
}

.tt-split-handle::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: var(--sidebar-dock-strip-bg, #404040);
  transition: background 0.15s ease;
}

.tt-split-handle:hover::after,
.tt-split-handle.is-dragging::after {
  background: color-mix(in srgb, var(--sidebar-dock-strip-bg, #404040) 72%, #ffffff);
}

body[data-theme="light"] .tt-split-handle:hover::after,
body[data-theme="light"] .tt-split-handle.is-dragging::after {
  background: color-mix(in srgb, var(--sidebar-dock-strip-bg) 82%, #000000);
}

.tt-pane__title {
  position: absolute;
  top: 6px;
  left: 8px;
  z-index: 3;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #9ca3af;
  pointer-events: none;
}

.tt-view3d,
.tt-pane--2d canvas {
  position: absolute;
  inset: 0;
}

.tt-3d-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 2;
  pointer-events: none;
}

.tt-3d-resolution {
  position: absolute;
  bottom: 8px;
  left: 8px;
  z-index: 3;
  font-size: 11px;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.8), 0 1px 2px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

body[data-theme="light"] .tt-3d-resolution {
  color: rgba(0, 0, 0, 0.6);
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.9), 0 1px 2px rgba(255, 255, 255, 0.8);
}

.tt-uv-canvas {
  z-index: 1;
}

.tt-uv-overlay {
  z-index: 2;
  pointer-events: auto;
  cursor: none;
}

.tt-empty {
  position: absolute;
  left: var(--tt-left-inset, 48px);
  right: var(--tt-right-inset, 275px);
  top: var(--tt-top-inset, 80px);
  bottom: var(--tt-bottom-inset, 40px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 12px;
  pointer-events: none;
  cursor: default;
  text-align: center;
  padding: 24px;
}

.tt-layer-row {
  width: 100%;
  border: 1px solid #404040;
  background: #262626;
  color: #dddddd;
  border-radius: 6px;
  padding: 6px 8px;
  text-align: left;
  cursor: pointer;
  margin: 4px 0;
  font-family: inherit;
  font-size: 12px;
}

.tt-layer-row:hover,
.tt-layer-row.is-active {
  background: #404040;
}

.panel {
  position: absolute;
  background: #262626;
  border-radius: 14px;
  border: 1px solid #404040;
  box-shadow:
    0 18px 45px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  color: #dddddd;
  display: flex;
  flex-direction: column;
}

.panel-header {
  flex-shrink: 0;
  padding: 0.6rem 0.9rem;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ca3af;
  border-bottom: 1px solid rgba(55, 65, 81, 0.75);
}

.layers-panel-header {
  flex-shrink: 0;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid rgba(55, 65, 81, 0.75);
}

.layers-search-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 0.4rem;
}

.search-input-icon {
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #dddddd;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

/* Vector: keep search bar vertically centered in its simpler header (no second row) */
#sidebar-vector-panel .layers-panel-header {
  display: flex;
  align-items: center;
}

#sidebar-vector-panel .layers-search-row {
  margin-bottom: 0;
  width: 100%;
}

.layer-search-input {
  flex: 1;
  min-width: 0;
  padding: 0.35rem 1.75rem 0.35rem 1.75rem;
  font-size: 12px;
  font-family: inherit;
  color: #dddddd;
  background: #333;
  border: 1px solid #404040;
  border-radius: 4px;
}

.layer-search-input::placeholder {
  color: #6b7280;
}

.layer-search-input:hover {
  border-color: #525252;
}

.layer-search-input:focus {
  outline: none;
  border-color: #525252;
  box-shadow: none;
}

.layer-search-clear {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.2rem;
  font-size: 14px;
  color: #9ca3af;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.layer-search-clear:hover {
  color: #dddddd;
  background: #404040;
}

.layer-search-clear:focus {
  outline: none;
}

.layer-search-clear[aria-hidden="true"] {
  visibility: hidden;
  pointer-events: none;
}

.layers-search-row .layer-search-clear {
  right: 0.35rem;
}

.layers-search-row .layer-search-input {
  padding-right: 1.75rem;
}

body[data-theme="light"] .search-input-icon {
  color: #1f2937;
}

body[data-theme="light"] .layer-search-input {
  color: #1f2937;
  background: #fff;
  border-color: #e8e8e8;
}

body[data-theme="light"] .layer-search-input::placeholder {
  color: #9ca3af;
}

body[data-theme="light"] .layer-search-input:hover,
body[data-theme="light"] .layer-search-input:focus {
  border-color: #d0d0d0;
}

body[data-theme="light"] .layer-search-clear {
  color: #6b7280;
}

body[data-theme="light"] .layer-search-clear:hover {
  color: #1f2937;
  background: #e5e5e5;
}

.layers-panel-header-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.layers-blend-wrap {
  flex: 1;
  min-width: 0;
}

.layers-blend-select {
  width: 100%;
  padding: 0.35rem 0.5rem;
  font-size: 12px;
  font-family: inherit;
  color: #dddddd;
  background: #333;
  border: 1px solid #404040;
  border-radius: 4px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 1.5rem;
}

.layers-blend-select:hover {
  border-color: #525252;
}

.layers-blend-select:focus {
  outline: none;
  border-color: #525252;
  box-shadow: none;
}

body[data-theme="light"] .layers-panel-header {
  border-bottom-color: #e8e8e8;
}

body[data-theme="light"] .layers-blend-select {
  color: #1f2937;
  background-color: #fff;
  border-color: #e8e8e8;
}

body[data-theme="light"] .layers-blend-select:hover {
  border-color: #d0d0d0;
}

body[data-theme="light"] .layers-blend-select:focus {
  border-color: #d0d0d0;
  box-shadow: none;
}

.layer-opacity-wrap {
  position: relative;
  flex-shrink: 0;
}

.layer-opacity-value {
  padding: 0.35rem 0.5rem;
  font-size: 12px;
  font-family: inherit;
  color: #dddddd;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  min-width: 2.5rem;
}

.layer-opacity-value:hover:not([aria-disabled="true"]) {
  background: #404040;
  border-color: #404040;
}

.layer-opacity-value[aria-disabled="true"] {
  color: #6b7280;
  cursor: default;
}

.layer-opacity-value:focus {
  outline: none;
}

.layer-opacity-popover {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  padding: 0.5rem 0.75rem;
  background: #333;
  border: 1px solid #404040;
  border-radius: var(--trumble-popup-radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 100;
}

.layer-opacity-popover.is-open {
  display: block;
}

.layer-modifiers-wrap {
  position: relative;
  flex-shrink: 0;
}
.layer-modifiers-popover {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 4px;
  padding: 0.25rem 0;
  width: max-content;
  min-width: 0;
  max-width: min(100vw - 24px, 320px);
  background: #333;
  border: 1px solid #404040;
  border-radius: var(--trumble-popup-radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 100;
}
.layer-modifiers-popover.is-open {
  display: block;
}
.layer-modifiers-popover__option {
  display: block;
  width: 100%;
  padding: 0.35rem 0.65rem;
  font-size: 12px;
  font-family: inherit;
  color: #e5e7eb;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  box-sizing: border-box;
}
.layer-modifiers-popover__option:hover {
  background: #404040;
}
body[data-theme="light"] .layer-modifiers-popover {
  background: #fff;
  border-color: #e8e8e8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
body[data-theme="light"] .layer-modifiers-popover__option {
  color: #1f2937;
}
body[data-theme="light"] .layer-modifiers-popover__option:hover {
  background: #f3f4f6;
}

.layer-mask-wrap {
  position: relative;
  flex-shrink: 0;
}
.layer-mask-popover {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 4px;
  padding: 0.25rem 0;
  width: max-content;
  min-width: 0;
  max-width: min(100vw - 24px, 320px);
  background: #333;
  border: 1px solid #404040;
  border-radius: var(--trumble-popup-radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 100;
}
.layer-mask-popover.is-open {
  display: block;
}
.layer-mask-popover__option {
  display: block;
  width: 100%;
  padding: 0.35rem 0.65rem;
  font-size: 12px;
  font-family: inherit;
  color: #e5e7eb;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  box-sizing: border-box;
}
.layer-mask-popover__option:hover {
  background: #404040;
}
body[data-theme="light"] .layer-mask-popover {
  background: #fff;
  border-color: #e8e8e8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
body[data-theme="light"] .layer-mask-popover__option {
  color: #1f2937;
}
body[data-theme="light"] .layer-mask-popover__option:hover {
  background: #f3f4f6;
}

.layer-opacity-label {
  display: block;
  font-size: 11px;
  color: #9ca3af;
  margin-bottom: 0.35rem;
}

/* When layer opacity label is used inside a compact slider row, remove extra margin */
.tr-slider-row .layer-opacity-label {
  margin-bottom: 0;
}

/* Ensure slider labels/values are vertically centered and share the same typography */
/* Base typography override for slider rows (earlier in file; a more specific override appears later). */
.tr-slider-row .paint-color-popover__label,
.tr-slider-row .paint-color-popover__value,
.tr-slider-row .paint-context-menu__label,
.tr-slider-row .paint-context-menu__value,
.tr-slider-row .layer-opacity-label {
  display: flex;
  align-items: center;
}

.layer-opacity-slider {
  width: 120px;
  height: 6px;
  accent-color: #60a5fa;
  cursor: pointer;
}

body[data-theme="light"] .layer-opacity-value {
  color: #1f2937;
}

body[data-theme="light"] .layer-opacity-value:hover:not([aria-disabled="true"]) {
  background: #e5e5e5;
  border-color: #e5e5e5;
}

body[data-theme="light"] .layer-opacity-value[aria-disabled="true"] {
  color: #9ca3af;
}

body[data-theme="light"] .layer-opacity-popover {
  background: #fff;
  border-color: #e8e8e8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body[data-theme="light"] .layer-opacity-label {
  color: #6b7280;
}

.panel-toolbar {
  top: 40px; /* below menu bar */
  left: 0;
  width: 40px;
  bottom: 32px; /* sit directly above status bar */
  border-radius: 0;
  border-top: none;
  border-bottom: none;
  border-left: none;
  border-right: 1px solid #404040;
  /* Keep toolbar dropdowns above options bar (z=12). */
  z-index: 14;
}

.toolbar-tools {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  /* No gap before the first separator: line must sit on same row as options panel bottom border */
  gap: 0;
}

/* Home tool: New + Load under the tool-switcher separator (same controls as options bar file actions). */
.toolbar-home-file-row {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  flex-shrink: 0;
  width: 100%;
  padding: 4px 0 2px;
  box-sizing: border-box;
}

.app-root[data-current-tool="home"] .toolbar-home-file-row {
  display: flex;
}

.toolbar-home-demos-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toolbar-top-band {
  flex-shrink: 0;
  width: 100%;
  height: 40px;
  min-height: 40px;
  max-height: 40px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.tool-switcher {
  padding: 0;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-switcher:hover {
  background: #404040;
}

.tool-switcher .ph-thin {
  font-size: 22px;
  color: #dddddd;
}
body[data-theme="light"] .tool-switcher .ph-thin {
  color: #262626;
}

.toolbar-tool-switcher-item {
  position: relative;
  flex-shrink: 0;
}

.toolbar-new-btn {
  padding: 0;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toolbar-new-btn:hover {
  background: #404040;
}

.toolbar-new-btn__icon-wrap {
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.toolbar-new-btn .ph-plus-square {
  font-size: 22px;
  color: inherit;
}

.toolbar-load-btn {
  padding: 0;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toolbar-load-btn:hover {
  background: #404040;
}
.toolbar-load-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.toolbar-load-btn__icon-wrap {
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.toolbar-load-btn .ph-hard-drive {
  font-size: 22px;
  color: inherit;
}

.toolbar-demos-btn .ph-disc {
  font-size: 22px;
  color: inherit;
}

.toolbar-home-demos-popup {
  position: absolute;
  top: 0;
  left: calc(100% + 8px);
  min-width: 128px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid #404040;
  background: #2a2a2a;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.38);
  z-index: 30;
}

/* `.panel` uses display:flex; [hidden] alone can lose to our display:flex above. */
.toolbar-home-demos-popup[hidden] {
  display: none !important;
}

.toolbar-home-demos-item {
  border: none;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  text-align: left;
  font-size: 12px;
  padding: 7px 8px;
  cursor: pointer;
}

.toolbar-home-demos-item:hover {
  background: #404040;
}

.toolbar-save-btn {
  padding: 0;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toolbar-save-btn:hover {
  background: #404040;
}
.toolbar-save-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.toolbar-save-btn__icon-wrap {
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.toolbar-save-btn .ph-floppy-disk {
  font-size: 22px;
  color: inherit;
}

.toolbar-library-btn {
  padding: 0;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.app-root[data-current-tool="paint"] .toolbar-library-btn {
  display: flex;
}

.toolbar-library-btn:hover {
  background: #404040;
}

.toolbar-library-btn__icon-wrap {
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.toolbar-library-btn .ph-books {
  font-size: 22px;
  color: inherit;
}

.toolbar-export-btn {
  padding: 0;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toolbar-export-btn:hover {
  background: #404040;
}

.toolbar-export-btn__icon-wrap {
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.toolbar-export-btn .ph-export {
  font-size: 22px;
  color: inherit;
}

.options-bar-file-separator {
  width: 1px;
  height: 30px;
  flex-shrink: 0;
  align-self: center;
  background: #404040;
}

.toolbar-undo-btn,
.toolbar-redo-btn {
  padding: 0;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toolbar-undo-btn:hover,
.toolbar-redo-btn:hover {
  background: #404040;
}
.toolbar-undo-btn:disabled,
.toolbar-redo-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.toolbar-undo-btn__icon-wrap,
.toolbar-redo-btn__icon-wrap {
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.toolbar-undo-btn .ph-arrow-u-up-left,
.toolbar-redo-btn .ph-arrow-u-up-right {
  font-size: 22px;
  color: inherit;
}

.toolbar-bake-btn {
  padding: 0;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.toolbar-bake-btn:hover {
  background: #404040;
}

.toolbar-bake-btn__icon-wrap {
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.toolbar-bake-btn .ph-oven {
  font-size: 22px;
  color: inherit;
}

/* Bake control lives only in #toolbar-texture-panel (between two separators) */
.app-root[data-current-tool="texture"] .toolbar-bake-btn {
  display: flex;
}

.app-root[data-current-tool="bake"] .toolbar-bake-btn {
  display: none;
}

.toolbar-separator {
  width: 30px;
  height: 1px;
  background: #404040;
  flex-shrink: 0;
}

.paint-toolbar {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  user-select: none;
  -webkit-user-select: none;
}

.app-root[data-current-tool="paint"] #toolbar-paint-panel .paint-toolbar {
  margin-top: 4px;
}

.texture-bake-popup {
  position: fixed;
  top: 140px;
  left: 96px;
  width: 520px;
  max-width: calc(100vw - 24px);
  background: #262626;
  border: 1px solid #404040;
  border-radius: var(--trumble-popup-radius);
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  color: #dddddd;
  z-index: 1200;
}

.texture-bake-popup[hidden] {
  display: none;
}

/* Message popup: size to content, center message and button */
.texture-bake-popup--message {
  width: max-content;
  min-width: 200px;
  max-width: min(460px, calc(100vw - 24px));
}
.texture-bake-popup--message .texture-bake-popup__body {
  align-items: center;
}
.texture-bake-popup--message .texture-bake-popup__text {
  text-align: center;
  margin: 0;
  width: 100%;
}

.texture-bake-popup__header {
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px 0 10px;
  border-bottom: 1px solid #404040;
  cursor: move;
  user-select: none;
  -webkit-user-select: none;
}

.texture-bake-popup__title {
  font-size: 12px;
  font-weight: 600;
}

.texture-bake-popup__close {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.texture-bake-popup__close:hover {
  background: #404040;
}

.texture-bake-popup__body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.texture-bake-popup__resolution {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.texture-bake-popup__label {
  font-size: 12px;
  font-weight: 600;
  color: #dddddd;
}

.texture-bake-popup__select {
  width: 100%;
  height: 26px;
  padding: 2px 8px;
  border: 1px solid #505050;
  border-radius: 4px;
  background: #262626;
  color: #dddddd;
  font-size: 12px;
}

.texture-bake-popup__input {
  width: 100%;
  height: 26px;
  padding: 2px 8px;
  border: 1px solid #505050;
  border-radius: 4px;
  background: #262626;
  color: #dddddd;
  font-size: 12px;
}

.texture-bake-popup__separator {
  width: 100%;
  height: 1px;
  background: #404040;
}

.texture-bake-popup__maps-label {
  font-size: 12px;
  font-weight: 600;
  color: #dddddd;
}

.texture-bake-popup__meshes-label {
  font-size: 12px;
  font-weight: 600;
  color: #dddddd;
}

.texture-bake-popup__mesh-toggle,
.texture-bake-popup__mesh-select-btn {
  width: 100%;
  min-height: 30px;
  padding: 6px 8px;
  border: 1px solid #505050;
  border-radius: 4px;
  background: #2f2f2f;
  color: #d0d0d0;
  font-size: 12px;
  text-align: center;
  cursor: pointer;
}

.texture-bake-popup__mesh-toggle:hover,
.texture-bake-popup__mesh-select-btn:hover {
  background: #383838;
}

.texture-bake-popup__mesh-toggle.is-active {
  background: #505050;
  border-color: #666666;
  color: #f0f0f0;
}

.texture-bake-popup__mesh-toggle:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: #2a2a2a;
}

.texture-bake-popup__preview-toggle-row {
  width: 100%;
  margin-top: 4px;
}

.texture-bake-popup__preview-cage-toggle {
  width: 100%;
}

.texture-bake-popup__mesh-list {
  min-height: 18px;
  flex: 1;
  font-size: 11px;
  color: #b8b8b8;
  line-height: 1.35;
  white-space: pre-line;
  word-break: break-word;
}

.texture-bake-popup__mesh-list-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
}

.texture-bake-popup__mesh-clear-btn {
  flex-shrink: 0;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid #505050;
  border-radius: 4px;
  background: #2f2f2f;
  color: #d0d0d0;
  font-size: 11px;
  cursor: pointer;
}

.texture-bake-popup__mesh-clear-btn:hover {
  background: #383838;
}

.texture-bake-popup__slider-row {
  width: 100%;
}

.texture-bake-popup__slider-input {
  inset: 0;
}

.texture-bake-popup__actions {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.texture-bake-popup__actions--single {
  display: flex;
  justify-content: center;
}

.texture-bake-popup__action-btn {
  min-height: 30px;
  padding: 6px 8px;
  border: 1px solid #505050;
  border-radius: 4px;
  background: #2f2f2f;
  color: #d0d0d0;
  font-size: 12px;
  text-align: center;
  cursor: pointer;
}

.texture-bake-popup__action-btn:hover {
  background: #383838;
}

.texture-bake-popup__action-btn--primary {
  background: #505050;
  border-color: #666666;
  color: #f0f0f0;
}

.bake-progress-bar {
  width: 100%;
  height: 12px;
  margin-top: 12px;
  border-radius: 0;
  background: #202020;
  overflow: hidden;
  position: relative;
}

.bake-progress-bar__fill {
  width: 40%;
  height: 100%;
  border-radius: 0;
  background: #60a5fa;
  position: absolute;
  left: -40%;
  animation: bakeProgressIndeterminate 1.2s ease-in-out infinite;
}

@keyframes bakeProgressIndeterminate {
  0% {
    left: -40%;
  }
  50% {
    left: 60%;
  }
  100% {
    left: 100%;
  }
}

.texture-bake-popup__action-btn--primary:hover {
  background: #5a5a5a;
}

/* Resource Importer popup (library panel) */
.resource-importer-popup {
  width: 460px;
  max-width: calc(100vw - 24px);
}

.resource-importer-popup__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 280px;
}

.resource-importer-popup__add-btn {
  width: 100%;
  min-height: 30px;
  padding: 6px 8px;
  border: 1px solid #505050;
  border-radius: 4px;
  background: #2f2f2f;
  color: #d0d0d0;
  font-size: 12px;
  text-align: center;
  cursor: pointer;
}

.resource-importer-popup__add-btn:hover {
  background: #383838;
}

.resource-importer-popup__list {
  flex: 1;
  min-height: 80px;
  padding: 8px;
  border: 1px solid #404040;
  border-radius: 4px;
  background: #1e1e1e;
  font-size: 12px;
  color: #888888;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.resource-importer-popup__row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

.resource-importer-popup__row-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #dddddd;
}

.resource-importer-popup__row-preview {
  flex-shrink: 0;
  height: 32px;
  width: auto;
  min-width: 24px;
  max-width: 96px;
  aspect-ratio: 2 / 1;
  border-radius: 4px;
  overflow: hidden;
  background: #2a2a2a;
  display: none;
  align-items: center;
  justify-content: center;
}

.resource-importer-popup__row-preview--visible {
  display: flex;
}

.resource-importer-popup__row-preview-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.resource-importer-popup__row-preview--placeholder .resource-importer-popup__row-preview-img {
  display: none;
}

.resource-importer-popup__row-preview--placeholder::after {
  content: "";
  width: 20px;
  height: 20px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23666'%3E%3Cpath d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.resource-importer-popup__row-type {
  flex-shrink: 0;
  width: 120px;
  height: 26px;
  padding: 2px 6px;
  border: 1px solid #505050;
  border-radius: 4px;
  background: #262626;
  color: #dddddd;
  font-size: 12px;
}

.resource-importer-popup__row-remove {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: 1px solid #505050;
  border-radius: 4px;
  background: #2f2f2f;
  color: #dddddd;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.resource-importer-popup__row-remove:hover {
  background: #3a3a3a;
}

.resource-importer-popup__destination {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.resource-importer-popup .texture-bake-popup__actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.save-library-popup {
  width: 380px;
  max-width: calc(100vw - 24px);
}

.save-library-popup__body {
  min-height: 220px;
}

.save-library-popup__row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.save-library-popup__actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#library-open-paint-confirm-popup {
  width: 360px;
  max-width: calc(100vw - 24px);
}

#library-open-paint-confirm-popup .texture-bake-popup__actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.texture-bake-popup__bake-options {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.texture-bake-popup__option-btn {
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid #505050;
  border-radius: 4px;
  background: #2f2f2f;
  color: #d0d0d0;
  font-size: 11px;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
}

.texture-bake-popup__option-btn:hover {
  background: #383838;
}

.texture-bake-popup__option-btn.is-active {
  background: #505050;
  border-color: #666666;
  color: #f0f0f0;
}

.texture-bake-popup__maps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.texture-bake-popup__map-btn {
  width: 100%;
  min-height: 34px;
  padding: 5px 8px;
  border: 1px solid #505050;
  border-radius: 4px;
  background: #2f2f2f;
  color: #d0d0d0;
  font-size: 11px;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
}

.texture-bake-popup__map-btn:hover {
  background: #383838;
}

.texture-bake-popup__map-btn.is-active {
  background: #505050;
  border-color: #666666;
  color: #f0f0f0;
}

.texture-bake-popup__text {
  font-size: 12px;
  color: #b5b5b5;
}

.tt-bake-cage-legend {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  gap: 4px;
  min-width: 150px;
  padding: 8px;
  border: 1px solid rgba(210, 210, 210, 0.2);
  border-radius: 6px;
  background: rgba(24, 24, 24, 0.75);
  color: #dcdcdc;
  font-size: 11px;
  line-height: 1.3;
  pointer-events: none;
  z-index: 25;
}

.tt-bake-cage-legend__row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tt-bake-cage-legend__swatch {
  width: 12px;
  height: 2px;
  border-radius: 2px;
  flex: 0 0 auto;
}

.tt-bake-cage-legend__title {
  font-weight: 600;
}

.tt-view-toggle-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.paint-tool-btn {
  padding: 0;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  user-select: none;
  -webkit-user-select: none;
}

.paint-tool-btn:hover {
  background: #404040;
}

.paint-tool-btn.is-active {
  background: #404040;
  border-color: transparent;
}
#texture-tool-brush:disabled,
#texture-tool-eraser:disabled,
#trim-tool-brush:disabled,
#trim-tool-eraser:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
body[data-theme="light"] #texture-tool-brush:disabled,
body[data-theme="light"] #texture-tool-eraser:disabled,
body[data-theme="light"] #trim-tool-brush:disabled,
body[data-theme="light"] #trim-tool-eraser:disabled {
  opacity: 0.5;
}

#texture-view-3d .ph-cube,
#texture-view-both .ph-cube-focus,
#texture-view-2d .ph-corners-out,
#bake-view-3d .ph-cube,
#bake-view-both .ph-cube-focus,
#bake-view-2d .ph-corners-out,
#trim-view-3d .ph-cube {
  font-size: 22px;
  color: inherit;
}

#paint-tool-move .ph-arrows-out-cardinal {
  font-size: 18px;
  color: inherit;
}

#paint-tool-marquee .ph-selection-plus {
  font-size: 18px;
  color: inherit;
}

#paint-tool-lasso .ph-lasso {
  font-size: 18px;
  color: inherit;
}

#texture-tool-select .ph-cursor,
#trim-tool-select .ph-cursor {
  font-size: 18px;
  color: inherit;
}

#paint-tool-eraser .ph-eraser,
#texture-tool-eraser .ph-eraser,
#trim-tool-eraser .ph-eraser,
#paint-tool-eyedropper .ph-eyedropper {
  font-size: 18px;
  color: inherit;
}

#paint-tool-clone .ph-stamp {
  font-size: 18px;
  color: inherit;
}

#paint-tool-gradient .ph-gradient {
  font-size: 18px;
  color: inherit;
}

#paint-tool-text .ph-text-aa {
  font-size: 20px;
  color: inherit;
}

/* Paint text transform: Phosphor icon over Konva rotate handle (DOM overlay).
   Must be position:absolute inside the Konva stage container so it stays aligned when
   the workspace uses CSS transforms (fixed + body would drift). */
.paint-transform-rotate-handle-icon {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 10000;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #5a8bde;
  background: #fff;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.paint-transform-rotate-handle-icon .ph {
  font-size: 14px;
  line-height: 1;
  color: #111;
}

body[data-theme="light"] .paint-transform-rotate-handle-icon {
  background: #fff;
  border-color: #5a8bde;
}

body[data-theme="light"] .paint-transform-rotate-handle-icon .ph {
  color: #111;
}

#paint-tool-fill .ph-paint-bucket {
  font-size: 18px;
  color: inherit;
}

#paint-tool-brush .ph-paint-brush,
#texture-tool-brush .ph-paint-brush,
#trim-tool-brush .ph-paint-brush {
  font-size: 18px;
  color: inherit;
}

#paint-tool-blur .ph-drop {
  font-size: 18px;
  color: inherit;
}

#paint-tool-sharp .ph-triangle {
  font-size: 18px;
  color: inherit;
}

/* Sharp tool: hidden in UI until behavior is fixed; #paint-tool-sharp stays in DOM for paint.js. */
#paint-tool-sharp {
  display: none !important;
}

/* Border-top hairline: matches flex neighbors better than filled 1px boxes (avoids uneven weight next to .toolbar-bake-btn). */
.paint-toolbar-separator {
  box-sizing: border-box;
  width: 30px;
  height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-top: 1px solid #404040;
  background: transparent;
  flex: 0 0 auto;
  align-self: center;
  line-height: 0;
}

.paint-toolbar-spacer {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.paint-color-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 4px;
  border: 1px solid #404040;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
}

.paint-color-btn--custom {
  position: relative;
  background:
    linear-gradient(var(--paint-color-swatch, rgba(0, 0, 0, 1)), var(--paint-color-swatch, rgba(0, 0, 0, 1))),
    repeating-conic-gradient(#666 0% 25%, #4b5563 0% 50%) 50% / 8px 8px;
}

.paint-color-between {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  flex-shrink: 0;
  color: inherit;
}

.paint-color-between .ph-thin {
  font-size: 14px;
}

.paint-color-popover {
  position: fixed;
  z-index: 2100;
  min-width: 220px;
  padding: 10px;
  background: #262626;
  border: 1px solid #404040;
  border-radius: var(--trumble-popup-radius);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  color: #dddddd;
}

.paint-color-popover__title {
  margin: 0 0 8px 0;
  font-size: 12px;
  color: #cbd5e1;
}

.paint-color-popover__row {
  margin: 8px 0;
}

.paint-color-popover__label {
  font-size: 12px;
}

.paint-color-popover__value {
  font-size: 12px;
  min-width: 36px;
  text-align: right;
}

.paint-color-popover__color {
  width: 100%;
  height: 30px;
  border: 1px solid #404040;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.paint-color-popover__slider {
  width: 100%;
}

/* In the toolbar primary/secondary color popups, match slider height to inputs below */
.paint-color-popover .tr-slider-row {
  height: 26px;
}

/* And match vertical spacing between alpha slider and dropdown/input block */
.paint-color-popover .paint-color-popover__row.tr-slider-row {
  margin-bottom: 7px;
}
.paint-color-popover .cp-mode-wrap {
  margin-top: 7px;
}

/* Generic Trumble slider row (label left, value right, filled bar background) */
.tr-slider-row {
  --tr-slider-fill: 0%;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 8px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid #404040;
  background:
    linear-gradient(
      to right,
      #333333 0,
      #333333 var(--tr-slider-fill),
      #1A1A1A var(--tr-slider-fill),
      #1A1A1A 100%
    );
  font-size: 11px;
  color: #e5e7eb;
}

.cp-hue-wrap--metallic {
  flex: 1;
  min-width: 0;
}
.cp-hue--metallic {
  position: relative;
  width: 100%;
  height: 16px;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  background: linear-gradient(to right, #000000 0, #ffffff 100%);
}

#texture-height-strip,
#texture-height-strip-fill {
  background: linear-gradient(to right, #ffffff 0%, #000000 50%, #ffffff 100%);
}
.cp-hue-handle--metallic {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
  pointer-events: none;
}

/* Color panel: neutral alpha slider styling to match inputs */
.dock-panel--color .paint-color-popover__row.tr-slider-row {
  height: 26px;
  border-radius: 4px;
  border: 1px solid #404040;
  background:
    linear-gradient(
      to right,
      #333333 0,
      #333333 var(--tr-slider-fill),
      #262626 var(--tr-slider-fill),
      #262626 100%
    );
}

.tr-slider-row .tr-slider-label {
  flex: 1;
}

.tr-slider-row .tr-slider-value {
  min-width: 40px;
  text-align: right;
}

.tr-slider-row .tr-slider-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.tr-slider-row .tr-slider-editor {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70px;
  padding: 2px 4px;
  font: inherit;
  font-size: 11px;
  text-align: center;
  color: inherit;
  background: transparent;
  border: none;
  border-radius: 0;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
}

.tr-slider-row .tr-slider-editor::-webkit-outer-spin-button,
.tr-slider-row .tr-slider-editor::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

body[data-theme="light"] .tr-slider-row {
  background:
    linear-gradient(
      to right,
      #60A5FA 0,
      #60A5FA var(--tr-slider-fill),
      #FFFFFF var(--tr-slider-fill),
      #FFFFFF 100%
    );
  color: #111827;
}

.tool-switcher__icon-wrap {
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

/* Override toolbar sizing when paint color button is reused in dock properties */
.dock-prop-section--color .paint-color-btn {
  flex: 1 1 auto;
  height: 26px;
  padding: 0;
  box-sizing: border-box;
}

/* Match Normal row color swatch to eyedropper/button height */
.dock-prop-section--normal .paint-color-btn {
  flex: 1 1 auto;
  height: 26px;
  padding: 0;
  box-sizing: border-box;
}

/* Match Emissive row color swatch to Color/Normal (same as top of panel) */
.dock-prop-section--emissive .paint-color-btn {
  flex: 1 1 auto;
  height: 26px;
  padding: 0;
  box-sizing: border-box;
}

.tool-switcher__image {
  width: 25px;
  height: 25px;
  object-fit: contain;
  display: block;
}

.tool-context-menu {
  position: absolute;
  left: 100%;
  top: 0;
  margin-left: 4px;
  min-width: 140px;
  padding: 4px 0;
  background: #262626;
  border: 1px solid #404040;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  display: none;
}

.tool-context-menu.is-open {
  display: block;
}

.paint-context-menu {
  position: fixed;
  z-index: 2000;
  min-width: 220px;
  padding: 10px 10px;
  background: #262626;
  border: 1px solid #404040;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  color: #dddddd;
}

.paint-context-menu.is-open {
  display: block;
}

.paint-context-menu__row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 6px;
  padding: 6px 4px;
}

.paint-context-menu__label {
  font-size: 12px;
  color: #cbd5e1;
  letter-spacing: 0.01em;
}

.paint-context-menu__value {
  font-size: 12px;
  color: #e5e7eb;
  text-align: right;
}

/* Inside our unified slider bar, labels and numbers share the same look and color. */
.tr-slider-row .paint-context-menu__label,
.tr-slider-row .paint-context-menu__value,
.tr-slider-row .paint-color-popover__label,
.tr-slider-row .paint-color-popover__value,
.tr-slider-row .layer-opacity-label {
  color: inherit;
  font-size: 11px;
  letter-spacing: 0;
  display: flex;
  align-items: center;
}

/* Light theme: override any more-specific label/value colors inside slider rows so label and number match */
body[data-theme="light"] .tr-slider-row .paint-context-menu__label,
body[data-theme="light"] .tr-slider-row .paint-context-menu__value,
body[data-theme="light"] .tr-slider-row .paint-color-popover__label,
body[data-theme="light"] .tr-slider-row .paint-color-popover__value,
body[data-theme="light"] .tr-slider-row .layer-opacity-label {
  color: inherit;
}

.paint-context-menu__slider {
  grid-column: 1 / -1;
  width: 100%;
}

body[data-theme="light"] .paint-context-menu {
  background: #fcfcfc;
  border-color: #e8e8e8;
  color: #262626;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
}

body[data-theme="light"] .paint-context-menu__label {
  color: #334155;
}

.tool-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: #dddddd;
  font-family: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.tool-option:hover {
  background: rgba(255, 255, 255, 0.08);
}

.tool-option__icon-wrap {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.tool-option__icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
}
.tool-option__phosphor-icon {
  font-size: 20px;
  color: #dddddd;
  display: flex;
  align-items: center;
  justify-content: center;
}
body[data-theme="light"] .tool-option__phosphor-icon {
  color: #262626;
}

.tool-option__label {
  flex: 1;
}

.toolbar-panel-content {
  flex: 1;
  display: none;
  flex-direction: column;
  min-height: 0;
}

.app-root[data-current-tool="home"] #toolbar-home-panel,
.app-root[data-current-tool="retopology"] #toolbar-retopology-panel,
.app-root[data-current-tool="texture"] #toolbar-texture-panel,
.app-root[data-current-tool="trim"] #toolbar-trim-panel,
.app-root[data-current-tool="bake"] #toolbar-bake-panel,
.app-root[data-current-tool="vector"] #toolbar-vector-panel,
.app-root[data-current-tool="paint"] #toolbar-paint-panel {
  display: flex;
}

.sidebar-panel-content {
  flex: 1;
  display: none;
  flex-direction: column;
  min-height: 0;
}

.app-root[data-current-tool="retopology"] #sidebar-retopology-panel,
.app-root[data-current-tool="texture"] #sidebar-texture-panel,
.app-root[data-current-tool="trim"] #sidebar-trim-panel,
.app-root[data-current-tool="bake"] #sidebar-bake-panel,
.app-root[data-current-tool="vector"] #sidebar-vector-panel,
.app-root[data-current-tool="paint"] #sidebar-paint-panel {
  display: flex;
}

.app-root[data-current-tool="home"] #sidebar-panel,
.app-root[data-current-tool="home"] #library-panel {
  display: none !important;
}

.app-root[data-current-tool="home"] .panel-toggle--sidebar,
.app-root[data-current-tool="home"] .panel-toggle--library {
  display: none !important;
}

.app-root[data-current-tool="home"] #options-bar {
  display: none !important;
}

.app-root[data-current-tool="home"] #menu-bar-file-item,
.app-root[data-current-tool="home"] #menu-bar-edit-item,
.app-root[data-current-tool="home"] #menu-bar-panels-item {
  display: none !important;
}

.panel-sidebar {
  top: 80px; /* below menu bar + options bar (match library panel) */
  right: calc(var(--ad-panel-width, 310px) + var(--rightbar-width, 15px));
  width: 260px;
  bottom: 32px; /* sit directly above status bar */
  border-radius: 0;
  border-top: none;
  border-bottom: none;
  border-right: none;
  border-left: 1px solid #404040;
  /* Below options (12), rightbar (9), toolbar (10); backdrop-filter on .panel needs a clear gap vs options */
  z-index: 6;
}

/* Bake tool: a bit more room for docked bake controls (Properties) without widening much */
.app-root[data-current-tool="bake"] .panel-sidebar {
  width: 288px;
}

.panel-rightbar {
  top: 40px; /* below menu bar (match .panel-toolbar / .panel-options) */
  right: var(--ad-panel-width, 310px);
  bottom: 32px; /* above status bar */
  width: var(--rightbar-width, 15px);
  border-radius: 0;
  border: none;
  border-left: 1px solid #404040;
  box-shadow: none;
  backdrop-filter: none;
  padding: 0;
  flex-shrink: 0;
  pointer-events: none;
  /* Stack: menu (15) > rightbar (13) > options (10) */
  z-index: 13;
}

.panel-sponsor {
  top: 40px; /* below menu bar */
  right: 0;
  bottom: 32px;
  width: var(--ad-panel-width, 310px);
  min-width: 0;
  max-width: 310px;
  border-radius: 0;
  border: none;
  border-left: 1px solid #404040;
  box-shadow: none;
  backdrop-filter: none;
  padding: 0;
  flex-shrink: 0;
  z-index: 13;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #1a1a1a;
  pointer-events: auto;
}

.sponsor-panel__inner {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 5px;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
}

.sponsor-panel__blocked-msg {
  display: none;
  margin: 0 0 4px;
  font-size: 11px;
  line-height: 1.35;
  color: #fff;
  text-align: center;
}

.sponsor-panel__slot {
  flex-shrink: 0;
  min-height: 260px;
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}

/* Slot row bands (blocked message is first child inside .sponsor-panel__inner) */
.sponsor-panel__inner > .sponsor-panel__slot:nth-child(2) {
  background: #c62828;
}
.sponsor-panel__inner > .sponsor-panel__slot:nth-child(3) {
  background: #2e7d32;
}
.sponsor-panel__inner > .sponsor-panel__slot:nth-child(4) {
  background: #1565c0;
}

/* Visible row count from JS (data-ad-rows) — hide lower slots so the column avoids scrolling */
#sponsor-panel[data-ad-rows="1"] .sponsor-panel__inner > .sponsor-panel__slot:nth-child(3),
#sponsor-panel[data-ad-rows="1"] .sponsor-panel__inner > .sponsor-panel__slot:nth-child(4) {
  display: none !important;
}

#sponsor-panel[data-ad-rows="2"] .sponsor-panel__inner > .sponsor-panel__slot:nth-child(4) {
  display: none !important;
}

.sponsor-panel__slot-content {
  width: 100%;
  height: 100%;
  max-width: 100%;
}

#sponsor-panel.sponsor-panel--blocked {
  background: #8b0000;
}

#sponsor-panel.sponsor-panel--blocked .sponsor-panel__inner {
  justify-content: center;
  padding: 8px;
}

#sponsor-panel.sponsor-panel--blocked .sponsor-panel__blocked-msg {
  display: block !important;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

/* Match :nth-child specificity of #sponsor-panel[data-ad-rows] rules so display:none !important wins over row bands. */
#sponsor-panel.sponsor-panel--blocked .sponsor-panel__inner > .sponsor-panel__slot:nth-child(2),
#sponsor-panel.sponsor-panel--blocked .sponsor-panel__inner > .sponsor-panel__slot:nth-child(3),
#sponsor-panel.sponsor-panel--blocked .sponsor-panel__inner > .sponsor-panel__slot:nth-child(4) {
  display: none !important;
  visibility: hidden;
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.sidebar-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.layers-toolbar {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  gap: 5px;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid rgba(55, 65, 81, 0.75);
  border-bottom: 1px solid rgba(55, 65, 81, 0.75);
}

.layers-toolbar-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  font-family: inherit;
  color: inherit;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.layers-toolbar-btn .ph-thin {
  font-size: 22px;
  color: inherit;
}

.layers-toolbar-btn:hover {
  background: #404040;
}

.layers-toolbar-btn:active {
  background: #505050;
}

.layers-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.25rem 0;
  position: relative;
}

.layers-list .layer-row__drag-hint {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  margin-right: 0.15rem;
  color: rgba(255, 255, 255, 0.28);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.layers-list .layer-row__drag-hint i {
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
}

.layers-list .layer-row__drag-hint:active {
  cursor: grabbing;
}

.layers-list .layer-row:not(.layer-row--locked) {
  cursor: grab;
}

.layers-list .layer-row:not(.layer-row--locked):active {
  cursor: grabbing;
}

.layers-list .layer-row--locked {
  cursor: default;
}

.layers-list .folder-row {
  cursor: grab;
}

.layers-list .folder-row:active {
  cursor: grabbing;
}

.layers-list .layer-row img,
.layers-list .folder-row img {
  -webkit-user-drag: none;
  user-drag: none;
}

.layer-drop-indicator {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #5A8BDE;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.08s ease;
}

.layer-drop-indicator.is-visible {
  opacity: 1;
}

.layer-row.is-dragging {
  opacity: 0.5;
}

.layer-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  min-width: 0;
  border-bottom: 1px solid transparent;
}

.layer-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.layer-row.is-selected {
  background: rgba(255, 255, 255, 0.08);
}

.layer-row--indent {
  padding-left: 1.25rem;
}

.modifier-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem 0.35rem 2rem;
  min-width: 0;
  border-bottom: 1px solid transparent;
  cursor: pointer;
}

.modifier-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.modifier-row.is-selected {
  background: rgba(255, 255, 255, 0.08);
}

.modifier-row__icon {
  font-size: 14px;
  color: inherit;
  flex-shrink: 0;
}

body[data-theme="light"] .modifier-row:hover {
  background: rgba(0, 0, 0, 0.04);
}

body[data-theme="light"] .modifier-row.is-selected {
  background: rgba(0, 0, 0, 0.08);
}

.folder-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  min-width: 0;
  border-bottom: 1px solid transparent;
}

.folder-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.folder-row.is-selected {
  background: rgba(255, 255, 255, 0.08);
}

.folder-row.is-dragging {
  opacity: 0.5;
}

.folder-row--drop-target {
  background: rgba(96, 165, 250, 0.2);
  outline: 1px dashed rgba(96, 165, 250, 0.6);
}

.folder-row__left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
}

.folder-row__icon-btn {
  padding: 2px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.folder-row__icon-btn:hover {
  background: #404040;
}

.folder-row__icon-btn svg {
  width: 16px;
  height: 16px;
}

.folder-row__mask-preview {
  flex-shrink: 0;
}

.folder-row__label {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-row__right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}

body[data-theme="light"] .folder-row.is-selected {
  background: rgba(0, 0, 0, 0.06);
}

body[data-theme="light"] .folder-row:hover {
  background: rgba(0, 0, 0, 0.04);
}

body[data-theme="light"] .folder-row__icon-btn:hover {
  background: #e8e8e8;
}

body[data-theme="light"] .folder-row--drop-target {
  background: rgba(59, 130, 246, 0.15);
  outline-color: rgba(59, 130, 246, 0.5);
}

.layer-row__left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
}

.layer-preview {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: #333;
  border: 1px solid #404040;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.layer-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.layer-preview--text {
  background: transparent;
  border-color: transparent;
}

.layer-preview-icon {
  font-size: 20px;
  color: inherit;
}

.layer-label {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-label-input {
  width: 100%;
  min-width: 3rem;
  font-size: 12px;
  font-family: inherit;
  color: inherit;
  background: #333;
  border: 1px solid #5A8BDE;
  border-radius: 2px;
  padding: 1px 4px;
  outline: none;
}

.layer-label-input:focus {
  box-shadow: 0 0 0 1px #5A8BDE;
}

body[data-theme="light"] .layer-label-input {
  background: #fff;
  border-color: #5A8BDE;
}

.layer-row__right {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  margin-left: auto;
}

.layer-row-btn {
  padding: 2px;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.layer-row-btn:hover {
  background: #404040;
}

.layer-row-btn svg {
  width: 14px;
  height: 14px;
}

.layers-context-menu {
  position: fixed;
  z-index: 2500;
  min-width: 160px;
  padding: 4px 0;
  background: #262626;
  border: 1px solid #404040;
  border-radius: var(--trumble-popup-radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  color: #dddddd;
}

.layers-context-menu.is-open {
  display: block;
}

.layers-context-menu__item {
  display: block;
  width: 100%;
  padding: 6px 12px;
  text-align: left;
  font-size: 12px;
  color: inherit;
  background: transparent;
  border: none;
  cursor: pointer;
}

.layers-context-menu__item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.layers-context-menu__item.is-disabled,
.layers-context-menu__item:disabled {
  opacity: 0.45;
  cursor: default;
}

.layers-context-menu__sep {
  display: block;
  height: 0;
  margin: 4px 8px;
  border: none;
  border-top: 1px solid #404040;
  opacity: 0.9;
}

.layers-context-menu__item--danger {
  color: #f87171;
}

.layers-context-menu__item.is-disabled:hover,
.layers-context-menu__item:disabled:hover {
  background: transparent;
}

body[data-theme="light"] .layers-context-menu {
  background: #fcfcfc;
  border-color: #e8e8e8;
  color: #262626;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

body[data-theme="light"] .layers-context-menu__item:hover {
  background: #e8e8e8;
}

body[data-theme="light"] .layers-context-menu__sep {
  border-top-color: #e0e0e0;
}

body[data-theme="light"] .layers-context-menu__item--danger {
  color: #dc2626;
}

.layer-row-btn.is-off {
  opacity: 0.45;
}

body[data-theme="light"] .layers-toolbar-btn:hover {
  background: #e0e0e0;
}

body[data-theme="light"] .layers-toolbar-btn:active {
  background: #d0d0d0;
}

body[data-theme="light"] .layers-toolbar {
  border-top-color: #e8e8e8;
}

body[data-theme="light"] .layers-list .layer-row__drag-hint {
  color: rgba(0, 0, 0, 0.28);
}

body[data-theme="light"] .layer-row:hover {
  background: rgba(0, 0, 0, 0.04);
}

body[data-theme="light"] .layer-row.is-selected {
  background: rgba(0, 0, 0, 0.08);
}

body[data-theme="light"] .layer-preview {
  background: #eee;
  border-color: #e8e8e8;
}

body[data-theme="light"] .layer-row-btn:hover {
  background: #e8e8e8;
}

.panel-menu {
  left: 0;
  right: 0;
  top: 0;
  height: 40px;
  flex-direction: row;
  align-items: center;
  padding: 0;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid #404040;
  /* Keep menu and its dropdowns above every in-app modal/popover layer. */
  z-index: 30000;
  display: flex;
  gap: 0;
  position: relative;
}

.menu-bar-brand {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 7.5rem;
  padding: 0 18px 0 11px;
  font-size: 24px;
  font-weight: 700;
  color: #dddddd;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  pointer-events: auto;
  cursor: pointer;
  z-index: 2;
  background: #262626;
  border: none;
  outline: none;
}

.menu-bar-brand:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(147, 197, 253, 0.9);
}

body[data-theme="light"] .menu-bar-brand {
  color: #262626;
  background: #fcfcfc;
}

.menu-bar-menus {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  /* Clear the wordmark so the divider sits past “Trumble”, not on it (24px bold + left pad) */
  margin-left: 7.5rem;
  border-left: 1px solid #404040;
  padding-left: 11px;
  min-height: 100%;
}

body[data-theme="light"] .menu-bar-menus {
  border-left-color: #e8e8e8;
}

.menu-bar-doc-name {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: #dddddd;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
  pointer-events: none;
  z-index: 1;
}
body[data-theme="light"] .menu-bar-doc-name {
  color: #262626;
}

.menu-bar-item {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.menu-bar-btn {
  padding: 0;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.menu-bar-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}
.menu-bar-btn__icon-wrap {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.menu-bar-btn__icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.menu-bar-btn__phosphor {
  font-size: 24px;
  color: #dddddd;
}
body[data-theme="light"] .menu-bar-btn__phosphor {
  color: #262626;
}

.menu-bar-dropdown {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 2px;
  min-width: 140px;
  padding: 4px 0;
  background: #262626;
  border: 1px solid #404040;
  border-radius: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  display: none;
  z-index: 30010;
}
.menu-bar-dropdown.is-open {
  display: block;
}

.toolbar-tool-switcher-item .toolbar-tool-dropdown {
  left: 100%;
  top: 0;
  margin-top: 0;
  margin-left: 4px;
}

.menu-bar-dropdown .tool-option {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 0;
  justify-content: flex-start;
}
.menu-bar-dropdown .tool-option__icon-wrap {
  margin-right: 8px;
}

.menu-bar-item--text {
  width: auto;
  padding: 0 0.3rem;
  height: 40px;
  display: flex;
  align-items: center;
}

/* Home: Privacy / About / Contact as three inline text buttons */
.menu-bar-item--site-links {
  flex-wrap: wrap;
  gap: 2px 6px;
  padding: 0 0.35rem 0 0.15rem;
  max-width: min(100%, 26rem);
}

.menu-bar-item--site-links .menu-bar-site-link {
  white-space: nowrap;
  padding: 0 6px;
}
.menu-bar-btn--text {
  width: auto;
  height: 22px;
  padding: 0 7px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  color: #dddddd;
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  box-sizing: border-box;
}
.menu-bar-btn--text:hover {
  background: rgba(255, 255, 255, 0.08);
}
.menu-bar-btn--text:focus {
  outline: none;
}
.menu-bar-btn--text:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 1px;
}
body[data-theme="light"] .menu-bar-btn--text {
  color: #262626;
}
body[data-theme="light"] .menu-bar-btn--text:hover {
  background: #e8e8e8;
}
body[data-theme="light"] .menu-bar-btn--text:focus-visible {
  outline-color: rgba(0, 0, 0, 0.4);
}
.menu-bar-menuitem {
  display: block;
  width: 100%;
  padding: 6px 14px;
  text-align: left;
  font-size: 12px;
  color: #dddddd;
  background: transparent;
  border: none;
  cursor: pointer;
}
.menu-bar-menuitem:hover {
  background: rgba(255, 255, 255, 0.08);
}
.menu-bar-menuitem.is-disabled,
.menu-bar-menuitem:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.menu-bar-menuitem.is-disabled:hover,
.menu-bar-menuitem:disabled:hover {
  background: transparent;
}
body[data-theme="light"] .menu-bar-menuitem {
  color: #262626;
}
body[data-theme="light"] .menu-bar-menuitem:hover {
  background: #e8e8e8;
}
body[data-theme="light"] .menu-bar-menuitem.is-disabled,
body[data-theme="light"] .menu-bar-menuitem:disabled {
  opacity: 0.5;
}
body[data-theme="light"] .menu-bar-menuitem.is-disabled:hover,
body[data-theme="light"] .menu-bar-menuitem:disabled:hover {
  background: transparent;
}

.panel-status {
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  box-sizing: border-box;
  bottom: 0;
  height: 32px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 0 0.75rem;
  border-radius: 0;
  border: none;
  border-top: 1px solid #404040;
  box-shadow: none;
  backdrop-filter: none;
  /* Above toolbar; menu dropdowns use their own z-index */
  z-index: 14;
  pointer-events: auto;
}

.panel-library {
  left: 40px; /* align with inside of toolbar */
  top: 80px; /* below menu bar + options bar (40 + 40) */
  bottom: 32px; /* above status bar */
  width: 260px; /* match sidebar width */
  border-radius: 0;
  border-left: none;
  border-right: 1px solid #404040;
  border-top: none;
  border-bottom: none;
  z-index: 7;
}

#library-panel *:focus {
  outline: none;
}

#library-panel *:focus-visible {
  outline: none;
}

.library-panel-header {
  flex-shrink: 0;
  padding: 0.5rem 0.75rem 0.4rem;
  width: 100%;
  box-sizing: border-box;
}

.library-panel-title {
  margin: 0 0 0.4rem 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #dddddd;
}

.library-search-row {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
}

.library-search-row .search-input-icon {
  left: 0.5rem;
}

.library-search-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 0.35rem 1.75rem 0.35rem 1.75rem;
  font-size: 12px;
  font-family: inherit;
  color: #dddddd;
  background: #333;
  border: 1px solid #404040;
  border-radius: 4px;
  box-sizing: border-box;
}

.library-search-input::placeholder {
  color: #6b7280;
}

.library-search-input[contenteditable="true"] {
  white-space: nowrap;
  overflow: hidden;
}

.library-search-input[contenteditable="true"]:empty::before {
  content: attr(data-placeholder);
  color: #6b7280;
  pointer-events: none;
}

.library-search-input:hover {
  border-color: #525252;
}

.library-search-input:focus {
  outline: none;
  border-color: #525252;
  box-shadow: none;
}

.library-search-clear {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.2rem;
  font-size: 14px;
  color: #9ca3af;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.library-search-clear:hover {
  color: #dddddd;
  background: #404040;
}

.library-search-clear:focus {
  outline: none;
}

.library-search-clear[aria-hidden="true"] {
  visibility: hidden;
  pointer-events: none;
}

.library-panel-separator {
  flex-shrink: 0;
  height: 1px;
  background: #404040;
  width: 100%;
}

.library-panel-import-row {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0.5rem 0.75rem;
  position: relative;
}

.library-panel-import-row-right {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  flex-shrink: 0;
}

.library-delete-imported-dialog {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 4px;
  width: 100%;
  box-sizing: border-box;
  background: #262626;
  border: 1px solid #404040;
  border-radius: var(--trumble-popup-radius);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  z-index: 50;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.library-item-context-menu {
  position: fixed;
  min-width: 140px;
  padding: 4px 0;
  background: #262626;
  border: 1px solid #404040;
  border-radius: var(--trumble-popup-radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 1600;
}

.library-item-context-menu[hidden] {
  display: none !important;
}

.library-item-context-menu__item {
  width: 100%;
  border: none;
  background: transparent;
  color: #dddddd;
  font: inherit;
  font-size: 12px;
  text-align: left;
  padding: 6px 10px;
  cursor: pointer;
}

.library-item-context-menu__item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.library-item-context-menu__item--danger {
  color: #f87171;
}

.library-delete-imported-dialog[hidden] {
  display: none !important;
  visibility: hidden;
  pointer-events: none;
}

.library-delete-imported-dialog__message {
  margin: 0 0 12px;
  font-size: 13px;
  color: #e5e5e5;
  line-height: 1.4;
}

.library-delete-imported-dialog__actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.library-delete-imported-dialog__btn {
  padding: 6px 14px;
  font-size: 12px;
  font-family: inherit;
  border-radius: 0;
  border: 1px solid #525252;
  background: #404040;
  color: #e5e5e5;
  cursor: pointer;
  width: auto;
  height: auto;
  min-width: 0;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.library-delete-imported-dialog__btn:hover {
  background: #4a4a4a;
  border-color: #5a5a5a;
}

.library-delete-imported-dialog__btn--primary {
  background: #b91c1c;
  border-color: #991b1b;
  color: #fff;
}

.library-delete-imported-dialog__btn--primary:hover {
  background: #dc2626;
  border-color: #b91c1c;
}

body[data-theme="light"] .library-delete-imported-dialog {
  background: #ffffff;
  border-color: #e5e7eb;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

body[data-theme="light"] .library-delete-imported-dialog__message {
  color: #374151;
}

body[data-theme="light"] .library-delete-imported-dialog__btn {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #111827;
}

body[data-theme="light"] .library-delete-imported-dialog__btn:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
}

body[data-theme="light"] .library-delete-imported-dialog__btn--primary {
  background: #dc2626;
  border-color: #b91c1c;
  color: #fff;
}

body[data-theme="light"] .library-delete-imported-dialog__btn--primary:hover {
  background: #ef4444;
  border-color: #dc2626;
}

body[data-theme="light"] .library-item-context-menu {
  background: #ffffff;
  border-color: #d0d0d0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

body[data-theme="light"] .library-item-context-menu__item {
  color: #111111;
}

body[data-theme="light"] .library-item-context-menu__item:hover {
  background: #f1f1f1;
}

body[data-theme="light"] .library-item-context-menu__item--danger {
  color: #b91c1c;
}

.library-panel-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.library-panel-view-label {
  flex-shrink: 0;
  padding: 0.4rem 0.75rem 0.25rem;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #9ca3af;
}

.library-panel-view-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.25rem 0;
}

.library-env-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0.5rem 0.75rem;
}

.library-panel-view-body.library-grid-large .library-env-grid {
  grid-template-columns: repeat(4, 1fr);
}

.library-env-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 0;
  border: 1px solid rgba(55, 65, 81, 0.75);
  border-radius: 6px;
  background: #2d2d2d;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: left;
  overflow: hidden;
}

.library-env-item:hover {
  border-color: #505050;
  background: #383838;
}

.library-env-item.is-active,
.library-env-item.is-selected {
  border-color: #60a5fa;
  box-shadow: 0 0 0 1px #60a5fa;
}

.library-env-preview {
  aspect-ratio: 2 / 1;
  width: 100%;
  min-height: 0;
  background: #1f2937;
  display: flex;
  align-items: center;
  justify-content: center;
}

.library-env-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.library-env-preview--placeholder {
  background: #374151;
}

.library-env-preview--placeholder img {
  display: none;
}

.library-env-preview--placeholder::after {
  content: "";
  display: block;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  background: currentColor;
  opacity: 0.3;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='currentColor' d='M216 40H40a16 16 0 0 0-16 16v144a16 16 0 0 0 16 16h176a16 16 0 0 0 16-16V56a16 16 0 0 0-16-16Zm0 16v115.36l-26.69-26.68a16 16 0 0 0-22.62 0l-20 20-44.69-44.68a16 16 0 0 0-22.62 0L40 149.37V56Z'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
}

.library-env-label {
  font-size: 11px;
  padding: 0 6px 6px;
  line-height: 1.3;
  color: #e5e7eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-all-item-label-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 6px 6px;
  min-width: 0;
}

.library-all-item-label-wrap .library-env-label {
  padding: 0;
}

.library-all-item-type {
  font-size: 10px;
  color: #9ca3af;
  text-transform: capitalize;
}

body[data-theme="light"] .library-all-item-type {
  color: #6b7280;
}

.library-env-empty {
  padding: 1rem 0.75rem;
  font-size: 12px;
  color: #9ca3af;
}

.library-hover-preview {
  position: fixed;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 360px;
  padding: 12px;
  /* Align with library card chrome */
  background: #2d2d2d;
  border: 1px solid #404040;
  border-radius: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.library-hover-preview[hidden] {
  display: none !important;
}

.library-hover-preview__img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 0;
  /* Match library tile / panel neutrals (avoid slate #1f2937 blue cast) */
  background: #2d2d2d;
}

.library-hover-preview--env .library-hover-preview__img {
  aspect-ratio: 2 / 1;
}

.library-hover-preview__name {
  margin-top: 10px;
  font-size: 13px;
  color: #e5e7eb;
  line-height: 1.3;
  word-break: break-word;
  white-space: normal;
}

body[data-theme="light"] .library-hover-preview {
  background: #f3f4f6;
  border-color: #e5e7eb;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

body[data-theme="light"] .library-hover-preview__img {
  background: #f3f4f6;
}

body[data-theme="light"] .library-hover-preview__name {
  color: #374151;
}

.library-imported-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0.5rem 0.75rem;
}

.library-panel-view-body.library-grid-large .library-imported-grid {
  grid-template-columns: repeat(4, 1fr);
}

.library-imported-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 0;
  border: 1px solid rgba(55, 65, 81, 0.75);
  border-radius: 6px;
  background: #2d2d2d;
  overflow: hidden;
  cursor: pointer;
}

.library-imported-item:hover {
  border-color: #505050;
  background: #383838;
}

.library-imported-item.is-selected {
  border-color: #60a5fa;
  box-shadow: 0 0 0 1px #60a5fa;
}

.library-builtin-material .library-builtin-badge {
  font-size: 10px;
  line-height: 1.2;
  padding: 2px 6px;
  margin: 0 6px 6px;
  align-self: flex-start;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: #9ca3af;
}

.library-builtin-material .library-builtin-badge[data-source="ambientcg"] {
  background: rgba(59, 130, 246, 0.22);
  color: #93c5fd;
}

.library-builtin-material .library-builtin-badge[data-source="freestylized"] {
  background: rgba(250, 204, 21, 0.22);
  color: #fde68a;
}

.library-imported-preview {
  aspect-ratio: 1;
  width: 100%;
  min-height: 0;
  /* Match library card background so the area behind the thumbnail is not a separate gray/blue block */
  background: #2d2d2d;
  display: flex;
  align-items: center;
  justify-content: center;
}

.library-imported-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.library-brush-preset-preview canvas.library-brush-preset-thumb {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.library-toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid rgba(55, 65, 81, 0.75);
}

.library-toolbar-left {
  display: flex;
  align-items: center;
  gap: 5px;
}

.library-toolbar-right {
  display: flex;
  align-items: center;
  gap: 5px;
}

.library-toolbar-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  font-family: inherit;
  color: inherit;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.library-toolbar-btn .ph-thin {
  font-size: 22px;
  color: inherit;
}

.library-toolbar-btn:hover {
  background: #404040;
}

.library-toolbar-btn:active,
.library-toolbar-btn.is-active {
  background: #505050;
}

body[data-theme="light"] .library-panel-title {
  color: #1f2937;
}

body[data-theme="light"] .library-search-input {
  color: #1f2937;
  background: #fff;
  border-color: #e8e8e8;
}

body[data-theme="light"] .library-search-input::placeholder {
  color: #9ca3af;
}

body[data-theme="light"] .library-search-input:hover,
body[data-theme="light"] .library-search-input:focus {
  border-color: #d0d0d0;
}

body[data-theme="light"] .library-search-clear {
  color: #6b7280;
}

body[data-theme="light"] .library-search-clear:hover {
  color: #1f2937;
  background: #e5e5e5;
}

body[data-theme="light"] .library-panel-separator {
  background: #e8e8e8;
}

body[data-theme="light"] .library-panel-view-label {
  color: #6b7280;
}

body[data-theme="light"] .library-toolbar {
  border-top-color: #e8e8e8;
}

body[data-theme="light"] .library-toolbar-btn:hover {
  background: #e0e0e0;
}

body[data-theme="light"] .library-toolbar-btn:active,
body[data-theme="light"] .library-toolbar-btn.is-active {
  background: #d0d0d0;
}

body[data-theme="light"] .library-env-item {
  background: #f3f4f6;
  border-color: #e5e7eb;
}

body[data-theme="light"] .library-env-item:hover {
  background: #e5e7eb;
  border-color: #d1d5db;
}

body[data-theme="light"] .library-env-item.is-active,
body[data-theme="light"] .library-env-item.is-selected {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px #3b82f6;
}

body[data-theme="light"] .library-imported-item {
  background: #f3f4f6;
  border-color: #e5e7eb;
}

body[data-theme="light"] .library-imported-item:hover {
  background: #e5e7eb;
  border-color: #d1d5db;
}

body[data-theme="light"] .library-imported-item.is-selected {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px #3b82f6;
}

body[data-theme="light"] .library-imported-preview {
  background: #f3f4f6;
}

body[data-theme="light"] .library-builtin-material .library-builtin-badge {
  background: rgba(0, 0, 0, 0.06);
  color: #6b7280;
}

body[data-theme="light"] .library-builtin-material .library-builtin-badge[data-source="ambientcg"] {
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
}

body[data-theme="light"] .library-builtin-material .library-builtin-badge[data-source="freestylized"] {
  background: rgba(250, 204, 21, 0.18);
  color: #b45309;
}

body[data-theme="light"] .library-env-preview {
  background: #e5e7eb;
}

body[data-theme="light"] .library-env-preview--placeholder {
  background: #d1d5db;
}

body[data-theme="light"] .library-env-label {
  color: #374151;
}

body[data-theme="light"] .library-env-empty {
  color: #6b7280;
}

.panel-options {
  left: 40px;
  right: calc(var(--ad-panel-width, 310px) + var(--rightbar-width, 15px)); /* left of #rightbar + #ad-panel; JS also sets */
  top: 40px;
  height: 40px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid #404040;
  box-shadow: none;
  /* Stack: menu (15) > rightbar/ad (13) > options (10) — options paints under the right column */
  z-index: 10;
  isolation: isolate;
}

.panel-options > .options-bar-grid {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
}

.options-bar-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  column-gap: 8px;
  box-sizing: border-box;
  padding: 0 4px;
}

.options-bar-col--left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  justify-self: start;
}

.options-bar-col--center {
  justify-self: center;
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.options-bar-col--right {
  min-width: 0;
  justify-self: end;
}

.paint-options-bar {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.paint-options-bar .tr-slider-row {
  width: 130px;
}

.paint-options-bar .tr-slider-row.paint-text-size-slider {
  width: 88px;
  flex: 0 0 auto;
  padding: 2px 6px;
  gap: 0;
}

.paint-options-bar .tr-slider-row[data-tt-option="assist"] .tr-slider-label {
  white-space: nowrap;
}

.paint-options-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Bake tool: shared bake form in dock-panel-bake */
#dock-panel-bake .dock-bake-options-shell {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 0.5rem 0.5rem;
}
#dock-panel-bake .dock-bake-options-shell .texture-bake-popup__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  width: 100%;
  max-width: none;
  padding: 8px 6px 12px;
}

/* Bake tool only: docked bake window layout adjustments */
body.bake-tool-layout #texture-bake-options-body .texture-bake-popup__maps {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
body.bake-tool-layout #texture-bake-options-body .texture-bake-popup__bake-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
body.bake-tool-layout #texture-bake-options-body .texture-bake-popup__actions {
  grid-template-columns: minmax(0, 1fr);
}
body.bake-tool-layout #texture-bake-options-body #texture-bake-cancel {
  display: none;
}
body:not(.bake-tool-layout) #texture-bake-options-body #texture-bake-low-poly-select,
body:not(.bake-tool-layout) #texture-bake-options-body #texture-bake-low-poly-input,
body:not(.bake-tool-layout) #texture-bake-options-body .texture-bake-popup__mesh-list-row--low-poly {
  display: none;
}

/* Text tool: keep font / weight / size grouped without stretching across the whole options bar. */
.paint-options-section--text {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 100%;
}

.paint-align-section {
  gap: 4px;
}

.paint-align-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.paint-align-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.paint-align-btn i {
  font-size: 22px;
  line-height: 1;
}

.paint-align-separator {
  width: 1px;
  height: 14px;
  background: #404040;
  margin: 0 4px;
}

body[data-theme="light"] .paint-align-btn:hover {
  background: #e8e8e8;
}

body[data-theme="light"] .paint-align-separator {
  background: #d1d5db;
}

.paint-options-row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 22px;
  padding: 2px 8px;
  border-radius: 6px;
  background: #333333;
  font-size: 11px;
  color: #e5e7eb;
}

.paint-options-label {
  flex: 1;
  white-space: nowrap;
  color: inherit;
  font-size: 11px;
}

.paint-options-select {
  height: 18px;
  min-width: 0;
  padding: 0 6px;
  border-radius: 4px;
  border: none;
  background: #333333;
  color: #e5e7eb;
  font-size: 11px;
  outline: none;
  cursor: pointer;
}

.paint-options-select:focus,
.paint-options-select:focus-visible {
  outline: none;
}

.paint-options-select--text-weight {
  flex: 0 0 auto;
  box-sizing: border-box;
  min-width: 4.75rem;
  max-width: 8.75rem;
  width: auto;
  padding-right: 1.1rem;
}

.paint-options-row--text-weight {
  flex: 0 0 auto;
  gap: 5px;
  min-width: 0;
  padding-left: 6px;
  padding-right: 6px;
}

.paint-options-row--text-weight .paint-options-label {
  flex: 0 0 auto;
}

.paint-text-size-slider .tr-slider-label {
  flex: 0 0 auto;
  padding-left: 0;
  padding-right: 0;
}

.paint-text-size-slider .tr-slider-value {
  flex: 0 0 auto;
  min-width: 1.25rem;
  margin-left: auto;
  padding-left: 0;
  padding-right: 0;
  font-variant-numeric: tabular-nums;
}

body[data-theme="light"] .paint-options-row {
  background: #FFFFFF;
  color: #111827;
}

body[data-theme="light"] .paint-options-label {
  color: inherit;
}

body[data-theme="light"] .paint-options-select {
  background: #FFFFFF;
  color: #111827;
}

/* Polotno-style paint font: trigger + fixed panel (search on top, full scrollable list, virtual rows). */
.paint-options-row--text-font {
  position: relative;
  z-index: 1;
}

.paint-options-row--text-font .paint-options-label {
  flex: 0 0 auto;
}

.paint-font-picker {
  position: relative;
  flex: 1;
  min-width: 0;
  max-width: min(280px, 42vw);
}

.paint-font-picker-trigger {
  display: block;
  width: 100%;
  height: 18px;
  min-width: 0;
  box-sizing: border-box;
  padding: 0 6px;
  border-radius: 4px;
  border: none;
  background: #333333;
  color: #e5e7eb;
  font-size: 11px;
  font-family: inherit;
  text-align: left;
  outline: none;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.paint-font-picker-trigger:focus,
.paint-font-picker-trigger:focus-visible {
  outline: none;
}

/* Dropdown is moved to document.body while open so position:fixed is viewport-based (see paint.js). */
.paint-font-picker-panel {
  position: fixed;
  z-index: 10060;
  display: flex;
  flex-direction: column;
  max-height: min(320px, calc(100vh - 24px));
  overflow: hidden;
  background: #1f2937;
  border: 1px solid #404040;
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  padding: 0;
  pointer-events: auto;
}

.paint-font-picker-panel-head {
  flex-shrink: 0;
  padding: 6px 8px 4px;
  border-bottom: 1px solid #404040;
}

.paint-font-picker-search {
  display: block;
  width: 100%;
  height: 26px;
  box-sizing: border-box;
  margin: 0;
  padding: 0 8px;
  border-radius: 4px;
  border: none;
  background: #333333;
  color: #e5e7eb;
  font-size: 12px;
  outline: none;
}

.paint-font-picker-search:focus,
.paint-font-picker-search:focus-visible {
  outline: none;
}

.paint-font-picker-count {
  margin-top: 4px;
  font-size: 10px;
  line-height: 1.25;
  color: #9ca3af;
  opacity: 0.9;
}

.paint-font-picker-scroll {
  position: relative;
  flex: 0 0 auto;
  height: 220px;
  min-height: 180px;
  max-height: 260px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.paint-font-picker-vp-inner {
  position: relative;
  width: 100%;
}

.paint-font-picker-empty {
  padding: 12px 10px;
  font-size: 12px;
  color: #9ca3af;
}

.paint-font-picker-item {
  position: absolute;
  left: 0;
  right: 0;
  box-sizing: border-box;
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: #e5e7eb;
  font-size: 12px;
  line-height: 28px;
  padding: 0 10px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.paint-font-picker-item:hover,
.paint-font-picker-item:focus-visible {
  background: #374151;
  outline: none;
}

body[data-theme="light"] .paint-font-picker-trigger {
  background: #ffffff;
  color: #111827;
}

body[data-theme="light"] .paint-font-picker-panel {
  background: #ffffff;
  border-color: #d1d5db;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}

body[data-theme="light"] .paint-font-picker-search {
  background: #f3f4f6;
  color: #111827;
}

body[data-theme="light"] .paint-font-picker-count {
  color: #6b7280;
}

body[data-theme="light"] .paint-font-picker-empty {
  color: #6b7280;
}

body[data-theme="light"] .paint-font-picker-item {
  color: #111827;
}

body[data-theme="light"] .paint-font-picker-item:hover,
body[data-theme="light"] .paint-font-picker-item:focus-visible {
  background: #f3f4f6;
}

.status-column {
  display: flex;
  align-items: center;
}

.status-column--left {
  justify-content: flex-start;
  gap: 0.5rem;
  min-width: 0;
}

.status-doc-meta {
  margin-left: auto;
  font-size: 12px;
  opacity: 0.7;
  white-space: nowrap;
  flex-shrink: 0;
}

.status-column--center {
  justify-content: center;
  align-items: center;
  min-width: 0;
}

.status-doc-name {
  font-size: 12px;
  opacity: 0.8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.status-column--right {
  justify-content: flex-end;
}

.status-text {
  font-size: 12px;
  opacity: 0.8;
}

.status-fullscreen-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 12px;
  cursor: pointer;
  border-radius: 4px;
}

.status-fullscreen-toggle .fullscreen-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.status-fullscreen-toggle .fullscreen-icon[hidden] {
  display: none;
}

.status-fullscreen-toggle .fullscreen-icon .ph-thin {
  font-size: 18px;
  color: inherit;
}

.status-fullscreen-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

body[data-theme="light"] .status-fullscreen-toggle:hover {
  background: #e8e8e8;
}

/* Paint: clone tool Alt-pick crosshair cursor overlay */
.paint-clone-crosshair {
  position: fixed;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #dddddd;
}

.paint-clone-crosshair .ph-thin {
  font-size: 24px;
}

body[data-theme="light"] .paint-clone-crosshair {
  color: #1f2937;
}

/* Paint: show X-circle cursor overlay when layer must rasterize */
.paint-rasterize-block-cursor {
  position: fixed;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #dddddd;
  opacity: 0.95;
}

.paint-rasterize-block-cursor .ph-thin {
  font-size: 24px;
}

body[data-theme="light"] .paint-rasterize-block-cursor {
  color: #1f2937;
}

/* Texture/Trim: Image mask picker (textures + alphas + import) */
.mask-image-picker-modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2100;
  padding: 1rem;
}
.mask-image-picker-modal[hidden] {
  display: none;
}
.mask-image-picker-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}
.mask-image-picker-modal__dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 420px;
  max-height: min(560px, calc(100vh - 2rem));
  padding: 0;
  background: #262626;
  border: 1px solid #404040;
  border-radius: var(--trumble-popup-radius);
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
}
.mask-image-picker-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #404040;
  flex-shrink: 0;
}
.mask-image-picker-modal__title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #dddddd;
}
.mask-image-picker-modal__close {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #dddddd;
  cursor: pointer;
}
.mask-image-picker-modal__close:hover {
  background: #404040;
}
.mask-image-picker-modal__search-row {
  padding: 0.65rem 1rem 0.5rem;
  flex-shrink: 0;
}
.mask-image-picker-modal__search {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.6rem;
  font: inherit;
  font-size: 12px;
  color: #e5e7eb;
  background: #1f1f1f;
  border: 1px solid #404040;
  border-radius: 0;
  outline: none;
}
.mask-image-picker-modal__search::placeholder {
  color: #9ca3af;
}
.mask-image-picker-modal__search:focus {
  border-color: rgba(96, 165, 250, 0.55);
}
.mask-image-picker-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 1rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.mask-image-picker-modal__grid {
  flex: 1 1 auto;
  min-height: 120px;
  max-height: 320px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-content: start;
  padding-bottom: 0.5rem;
}
.mask-image-picker-modal__item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  margin: 0;
  padding: 6px;
  border: 1px solid #404040;
  border-radius: 0;
  background: #1f1f1f;
  color: #e5e7eb;
  font: inherit;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}
.mask-image-picker-modal__item:hover {
  background: #2a2a2a;
  border-color: #525252;
}
.mask-image-picker-modal__preview {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #141414;
  border-radius: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mask-image-picker-modal__preview img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.mask-image-picker-modal__item-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9ca3af;
}
.mask-image-picker-modal__item-label {
  display: block;
  line-height: 1.25;
  word-break: break-word;
  color: #e5e7eb;
}
.mask-image-picker-modal__empty,
.mask-image-picker-modal__loading {
  grid-column: 1 / -1;
  padding: 1.25rem 0.5rem;
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
}
.mask-image-picker-modal__footer {
  flex-shrink: 0;
  padding: 0.65rem 1rem 1rem;
  border-top: 1px solid #404040;
}
.mask-image-picker-modal__import-btn {
  width: 100%;
  margin: 0;
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-size: 12px;
  color: #dddddd;
  background: #1f1f1f;
  border: 1px solid #404040;
  border-radius: 0;
  cursor: pointer;
  box-sizing: border-box;
}
.mask-image-picker-modal__import-btn:hover {
  background: #2a2a2a;
}
body[data-theme="light"] .mask-image-picker-modal__dialog {
  background: #fcfcfc;
  border-color: #e8e8e8;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
}
body[data-theme="light"] .mask-image-picker-modal__header {
  border-bottom-color: #e8e8e8;
}
body[data-theme="light"] .mask-image-picker-modal__title {
  color: #111827;
}
body[data-theme="light"] .mask-image-picker-modal__close {
  color: #111827;
}
body[data-theme="light"] .mask-image-picker-modal__close:hover {
  background: #e8e8e8;
}
body[data-theme="light"] .mask-image-picker-modal__search {
  color: #111827;
  background: #f9fafb;
  border-color: #e8e8e8;
}
body[data-theme="light"] .mask-image-picker-modal__search::placeholder {
  color: #6b7280;
}
body[data-theme="light"] .mask-image-picker-modal__item {
  background: #f3f4f6;
  border-color: #e8e8e8;
  color: #111827;
}
body[data-theme="light"] .mask-image-picker-modal__item:hover {
  background: #e8e8e8;
}
body[data-theme="light"] .mask-image-picker-modal__item-label {
  color: #111827;
}
body[data-theme="light"] .mask-image-picker-modal__footer {
  border-top-color: #e8e8e8;
}
body[data-theme="light"] .mask-image-picker-modal__import-btn {
  color: #111827;
  background: #f3f4f6;
  border-color: #e8e8e8;
}
body[data-theme="light"] .mask-image-picker-modal__import-btn:hover {
  background: #e8e8e8;
}
body[data-theme="light"] .mask-image-picker-modal__empty,
body[data-theme="light"] .mask-image-picker-modal__loading {
  color: #6b7280;
}

/* Paint: New document modal (centered in workspace) */
.paint-new-modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Keep create-doc overlay below app popups/menus (many are 1000-2500). */
  z-index: 900;
  padding: 1rem;
}

.paint-new-modal[hidden] {
  display: none;
}

.paint-new-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 0;
}

.paint-new-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  padding: 1.5rem;
  background: #262626;
  border: 1px solid #404040;
  border-radius: var(--trumble-popup-radius);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}

.paint-new-dialog__title {
  margin: 0 0 1.25rem;
  font-size: 12px;
  font-weight: 600;
  color: #dddddd;
}

/* Paint new document title: subheader/headline (same as Texture/Trim) */
.paint-new-dialog__title--headline {
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.paint-export-modal__hint {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  line-height: 1.45;
  color: #b0b0b0;
}

/* Paint new form: full-width inputs */
#paint-new-form .paint-new-form__input--full {
  max-width: 100%;
}

/* Paint new form: width and height on same row */
.paint-new-form__row--width-height {
  display: flex;
  gap: 0.75rem;
}
.paint-new-form__row--width-height .paint-new-form__field {
  flex: 1;
  min-width: 0;
}
.paint-new-form__row--width-height .paint-new-form__input {
  max-width: 100%;
}

/* Paint new form: color mode and bit depth on same row */
.paint-new-form__row--color-mode {
  display: flex;
  gap: 0.75rem;
}
.paint-new-form__row--color-mode .paint-new-form__field {
  flex: 1;
  min-width: 0;
}
.paint-new-form__row--color-mode .paint-new-form__input {
  max-width: 100%;
}

/* Texture/Trim new document title: make it stand out more as a subheader/headline */
#tt-new-title {
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.paint-new-form__row {
  margin-bottom: 1rem;
}

.paint-new-form__row--presets {
  margin-bottom: 1.25rem;
}

.paint-new-form__label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 12px;
  color: #aaaaaa;
}

.paint-new-form__input {
  width: 100%;
  max-width: 12rem;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-size: 12px;
  color: #dddddd;
  background: #1a1a1a;
  border: 1px solid #404040;
  border-radius: 6px;
}

/* Texture/Trim: document name should stretch full width */
#tt-new-name.paint-new-form__input {
  max-width: 100%;
}

/* Texture/Trim: custom model chooser layout */
.tt-new-model-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.tt-new-model-choose-btn {
  flex: 1 1 auto;
  width: 100%;
}

.tt-new-model-display {
  flex: 0 1 auto;
  max-width: 100%;
}

.tt-new-model-row.tt-new-model-row--has-model .tt-new-model-choose-btn {
  flex: 0 0 auto;
  width: auto;
}

.tt-new-model-row.tt-new-model-row--has-model .tt-new-model-display {
  flex: 1 1 auto;
}

.tt-new-bake-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.tt-new-high-poly-select-btn {
  flex: 1;
  width: 100%;
}

.tt-new-high-poly-select-btn[hidden] {
  display: none;
}

/* Mesh name + Clear hidden until high poly selected; select button is the only visible element initially */
#tt-new-bake-selected-wrap {
  display: none;
}

#tt-new-bake-selected-wrap:not([hidden]) {
  display: flex;
}

.tt-new-bake-selected-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.tt-new-bake-selected-row .tt-new-model-display {
  flex: 1;
}

.tt-new-bake-selected-row .paint-new-btn {
  flex-shrink: 0;
}

/* Texture/Trim: dimensions dropdown — full width, centered, no focus outline */
.tt-new-size-select {
  width: 100%;
  max-width: 100%;
  text-align: center;
}
.tt-new-size-select:focus {
  outline: none;
  border-color: #404040;
  box-shadow: none;
}
.tt-new-size-select option {
  text-align: center;
}

.tt-export-dialog {
  max-width: 460px;
}

#tt-export-name.paint-new-form__input,
#tt-export-size.paint-new-form__input,
#tt-export-format.paint-new-form__input {
  max-width: 100%;
}

.tt-export-map-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 1rem;
}

.tt-export-map-grid .tt-export-map-btn {
  width: 100%;
}

.tt-export-error {
  min-height: 1rem;
  margin-top: -0.25rem;
  margin-bottom: 0.5rem;
  font-size: 11px;
  color: #f08a8a;
}

.tt-export-error:empty {
  min-height: 0;
  margin: 0;
}

.tt-export-separator {
  border: 0;
  border-top: 1px solid #404040;
  margin: 0.35rem 0 0;
}

.tt-export-dialog .paint-new-form__actions {
  margin-top: 1.25rem;
  padding-top: 1rem;
}

.paint-new-form__input:focus,
.paint-new-form__select:focus {
  outline: none;
  border-color: #404040;
  box-shadow: none;
}

/* Dark theme: spinner arrows match input text color (#dddddd) on dark background */
.paint-new-form__input[type="number"]::-webkit-inner-spin-button,
.paint-new-form__input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
  opacity: 1;
  margin: 0;
  cursor: pointer;
}
.paint-new-form__input[type="number"]::-webkit-inner-spin-button {
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath fill='%23dddddd' d='M5 1L1 5h8L5 1z'/%3E%3Cpath fill='%23dddddd' d='M1 9h8L5 13 1 9z'/%3E%3C/svg%3E") no-repeat center;
  background-size: 8px 14px;
  width: 1rem;
  min-height: 1.25rem;
}
.paint-new-form__input[type="number"]::-webkit-outer-spin-button {
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath fill='%23dddddd' d='M5 1L1 5h8L5 1z'/%3E%3Cpath fill='%23dddddd' d='M1 9h8L5 13 1 9z'/%3E%3C/svg%3E") no-repeat center;
  background-size: 8px 14px;
  width: 1rem;
  min-height: 1.25rem;
}

.paint-new-form__select {
  cursor: pointer;
  min-width: 10rem;
  border-radius: 6px;
  background-clip: padding-box;
}

.paint-new-form__unit {
  margin-left: 0.25rem;
  font-size: 12px;
  color: #888;
}

.paint-new-form__presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.paint-new-preset {
  padding: 0.35rem 0.6rem;
  font-size: 12px;
  color: #dddddd;
  background: #333;
  border: 1px solid #404040;
  border-radius: 6px;
  cursor: pointer;
}

.paint-new-preset:hover {
  background: #404040;
}

.paint-new-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #404040;
}

.paint-new-btn {
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
}

.paint-new-btn--primary {
  color: #fff;
  background: #5A8BDE;
  border-color: #5A8BDE;
}

.paint-new-btn--primary:hover {
  background: #4a7bc9;
  border-color: #4a7bc9;
}

.paint-new-btn--secondary {
  color: #dddddd;
  background: transparent;
  border-color: #404040;
}

.paint-new-btn--secondary:hover {
  background: #333;
}

body[data-theme="light"] .paint-new-dialog {
  background: #fcfcfc;
  border-color: #e8e8e8;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.15);
}

body[data-theme="light"] .paint-new-dialog__title {
  color: #262626;
}

body[data-theme="light"] .paint-new-form__label {
  color: #555;
}

body[data-theme="light"] .paint-new-form__input {
  color: #262626;
  background: #fff;
  border-color: #e8e8e8;
}

/* Light theme: spinner arrows match input text color (#262626) on light background */
body[data-theme="light"] .paint-new-form__input[type="number"]::-webkit-inner-spin-button,
body[data-theme="light"] .paint-new-form__input[type="number"]::-webkit-outer-spin-button {
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 14'%3E%3Cpath fill='%23262626' d='M5 1L1 5h8L5 1z'/%3E%3Cpath fill='%23262626' d='M1 9h8L5 13 1 9z'/%3E%3C/svg%3E") no-repeat center;
  background-size: 8px 14px;
}

body[data-theme="light"] .paint-new-form__input:focus,
body[data-theme="light"] .paint-new-form__select:focus {
  border-color: #d0d0d0;
}

body[data-theme="light"] .paint-new-preset {
  color: #262626;
  background: #eee;
  border-color: #e8e8e8;
}

body[data-theme="light"] .paint-new-preset:hover {
  background: #e0e0e0;
}

body[data-theme="light"] .paint-new-form__actions {
  border-top-color: #e8e8e8;
}

body[data-theme="light"] .paint-new-btn--secondary {
  color: #262626;
  border-color: #e8e8e8;
}

body[data-theme="light"] .paint-new-btn--secondary:hover {
  background: #e8e8e8;
}

.panel-toggle {
  position: absolute;
  border: none;
  background: transparent;
  color: #dddddd; /* match light text */
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 4px 6px;
}

.panel-toggle:hover {
  color: #ffffff;
}

.panel-toggle:focus,
.panel-toggle:focus-visible {
  outline: none;
}

.panel-toggle--toolbar {
  /* Sit just below menu + options bars (40px + 40px from panel top) */
  top: 44px;
  left: 100%;
  margin-left: 4px;
}

.panel-toggle--sidebar {
  /* Align near panel top edge with small offset */
  top: 4px;
  right: 100%;
  margin-right: 4px;
}

.panel-toggle--library {
  /* Align near panel top edge with small offset */
  top: 4px;
  left: 100%;
  margin-left: 4px;
}

.panel {
  transition: transform 0.25s ease-out, opacity 0.2s ease-out;
}

.panel--collapsed-toolbar {
  /* Slide toolbar fully off the left edge, leaving only the toggle visible */
  transform: translateX(calc(-100% + 4px));
}

.panel--collapsed-sidebar {
  /* Slide sidebar fully off the right edge, leaving only the toggle visible */
  transform: translateX(calc(100% - 4px));
}

.panel--collapsed-library {
  /* Slide library panel left so only the toggle remains visible (like toolbar) */
  transform: translateX(calc(-100% + 4px));
}

.theme-toggle {
  margin-top: auto;
  margin-bottom: 0.6rem;
  align-self: center;
  padding: 0;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: #dddddd;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background: #404040;
}

body[data-theme="light"] {
  background-color: #fcfcfc;
  color: #262626;
  --sidebar-dock-strip-bg: #e8e8e8;
}

body[data-theme="light"] .app-root {
  background: radial-gradient(circle at top left, #fcfcfc, #f0f0f0 60%);
}

body[data-theme="light"] .workspace {
  background: radial-gradient(circle at center, #fcfcfc 0, #f0f0f0 55%);
}

body[data-theme="light"] .panel {
  background: #fcfcfc;
  border-color: #e8e8e8;
  color: #262626;
  box-shadow:
    0 16px 32px rgba(15, 23, 42, 0.1),
    0 0 0 1px #e8e8e8;
}

body[data-theme="light"] .panel-status {
  box-shadow: none;
  backdrop-filter: none;
}

body[data-theme="light"] .panel-menu {
  border-bottom-color: #e8e8e8;
}
body[data-theme="light"] .panel-options {
  border-bottom-color: #e8e8e8;
}
body[data-theme="light"] .panel-rightbar {
  border-left-color: #e8e8e8;
}
body[data-theme="light"] .panel-sponsor {
  border-left-color: #e8e8e8;
  background: #f0f0f0;
}
body[data-theme="light"] #sponsor-panel.sponsor-panel--blocked {
  background: #b91c1c;
}

body[data-theme="light"] #sponsor-panel.sponsor-panel--blocked .sponsor-panel__blocked-msg {
  color: #ffffff !important;
}
body[data-theme="light"] .menu-bar-btn:hover {
  background: #e8e8e8;
}
body[data-theme="light"] .menu-bar-dropdown {
  background: #fcfcfc;
  border-color: #e8e8e8;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

body[data-theme="light"] .panel-toggle {
  color: #262626;
}

body[data-theme="light"] .panel-toggle:hover {
  color: #262626;
}

body[data-theme="light"] .dock-add-bar {
  border-bottom-color: #d0d0d0;
}
body[data-theme="light"] .dock-add-btn {
  background: #e8e8e8;
  border-color: #e0e0e0;
  color: #262626;
}
body[data-theme="light"] .dock-add-btn:hover {
  background: #ddd;
}
body[data-theme="light"] .dock-add-menu {
  background: #fafafa;
  border-color: #e0e0e0;
}
body[data-theme="light"] .dock-add-menu-item {
  color: #262626;
}
body[data-theme="light"] .dock-add-menu-item:hover {
  background: #e8e8e8;
}
body[data-theme="light"] .dock-slot-tabs {
  border-bottom-color: #d0d0d0;
}
body[data-theme="light"] .dock-tab {
  /* Former active-tab color for inactive tabs */
  background: #ddd;
  border-color: #e0e0e0;
  color: #262626;
}
body[data-theme="light"] .dock-tab:hover {
  background: #e8e8e8;
  color: #111;
  border-bottom-color: #e8e8e8;
}
body[data-theme="light"] .dock-tab.is-active {
  /* Match light .panel background */
  background: #fcfcfc;
  color: #111;
  border-bottom: 1px solid #e8e8e8;
  margin-bottom: -1px;
}
body[data-theme="light"] .dock-tab__close:hover {
  background: rgba(0,0,0,0.08);
}
body[data-theme="light"] .dock-drop-zone.is-drag-over {
  background: linear-gradient(to bottom, transparent 0, transparent 3px, #a0b8ff 3px, #a0b8ff 5px, transparent 5px);
}

body[data-theme="light"] .theme-toggle {
  background: transparent;
  color: #262626;
  border: none;
  border-radius: 4px;
}

body[data-theme="light"] .theme-toggle:hover {
  background: #e8e8e8;
}

body[data-theme="light"] .tool-switcher:hover {
  background: #e8e8e8;
}

body[data-theme="light"] .toolbar-new-btn:hover {
  background: #e8e8e8;
}

body[data-theme="light"] .toolbar-load-btn:hover {
  background: #e8e8e8;
}

body[data-theme="light"] .toolbar-home-demos-popup {
  background: #fafafa;
  border-color: #e0e0e0;
}

body[data-theme="light"] .toolbar-home-demos-item:hover {
  background: #e8e8e8;
}

body[data-theme="light"] .toolbar-save-btn:hover {
  background: #e8e8e8;
}

body[data-theme="light"] .toolbar-library-btn:hover {
  background: #e8e8e8;
}

body[data-theme="light"] .toolbar-export-btn:hover {
  background: #e8e8e8;
}

body[data-theme="light"] .options-bar-file-separator {
  background: #e8e8e8;
}

body[data-theme="light"] .toolbar-undo-btn:hover,
body[data-theme="light"] .toolbar-redo-btn:hover {
  background: #e8e8e8;
}

body[data-theme="light"] .toolbar-bake-btn:hover {
  background: #e8e8e8;
}

body[data-theme="light"] .toolbar-separator {
  background: #e8e8e8;
}

body[data-theme="light"] .paint-toolbar-separator {
  background: transparent;
  border-top-color: #e8e8e8;
}

body[data-theme="light"] .paint-tool-btn:hover {
  background: #e8e8e8;
}

body[data-theme="light"] .paint-tool-btn.is-active {
  background: #e8e8e8;
  border-color: transparent;
}

body[data-theme="light"] .paint-color-btn {
  border-color: #e8e8e8;
}

body[data-theme="light"] .paint-color-popover {
  background: #fcfcfc;
  border-color: #e8e8e8;
  color: #262626;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
}

body[data-theme="light"] .texture-bake-popup {
  background: #ffffff;
  border-color: #d0d0d0;
  color: #111111;
}

body[data-theme="light"] .texture-bake-popup__header {
  border-bottom-color: #d0d0d0;
}

body[data-theme="light"] .texture-bake-popup__separator {
  background: #d0d0d0;
}

body[data-theme="light"] .texture-bake-popup__close:hover {
  background: #ececec;
}

body[data-theme="light"] .texture-bake-popup__label,
body[data-theme="light"] .texture-bake-popup__maps-label,
body[data-theme="light"] .texture-bake-popup__meshes-label {
  color: #111111;
}

body[data-theme="light"] .texture-bake-popup__select {
  border-color: #d0d0d0;
  background: #ffffff;
  color: #111111;
}

body[data-theme="light"] .texture-bake-popup__input {
  border-color: #d0d0d0;
  background: #ffffff;
  color: #111111;
}

body[data-theme="light"] .texture-bake-popup__map-btn {
  border-color: #d0d0d0;
  background: #ffffff;
  color: #111111;
}

body[data-theme="light"] .texture-bake-popup__map-btn:hover {
  background: #f3f3f3;
}

body[data-theme="light"] .texture-bake-popup__map-btn.is-active {
  background: #e8e8e8;
  border-color: #c2c2c2;
  color: #111111;
}

body[data-theme="light"] .texture-bake-popup__mesh-toggle,
body[data-theme="light"] .texture-bake-popup__mesh-select-btn {
  border-color: #d0d0d0;
  background: #ffffff;
  color: #111111;
}

body[data-theme="light"] .texture-bake-popup__mesh-toggle:hover,
body[data-theme="light"] .texture-bake-popup__mesh-select-btn:hover {
  background: #f3f3f3;
}

body[data-theme="light"] .texture-bake-popup__mesh-toggle.is-active {
  background: #e8e8e8;
  border-color: #c2c2c2;
}

body[data-theme="light"] .texture-bake-popup__mesh-toggle:disabled {
  background: #f1f1f1;
}

body[data-theme="light"] .texture-bake-popup__mesh-list {
  color: #444444;
}

body[data-theme="light"] .texture-bake-popup__mesh-clear-btn {
  border-color: #d0d0d0;
  background: #ffffff;
  color: #111111;
}

body[data-theme="light"] .texture-bake-popup__mesh-clear-btn:hover {
  background: #f3f3f3;
}

body[data-theme="light"] .texture-bake-popup__action-btn {
  border-color: #d0d0d0;
  background: #ffffff;
  color: #111111;
}

body[data-theme="light"] .texture-bake-popup__action-btn:hover {
  background: #f3f3f3;
}

body[data-theme="light"] .texture-bake-popup__action-btn--primary {
  background: #e8e8e8;
  border-color: #c2c2c2;
}

body[data-theme="light"] .texture-bake-popup__option-btn {
  border-color: #d0d0d0;
  background: #ffffff;
  color: #111111;
}

body[data-theme="light"] .texture-bake-popup__option-btn:hover {
  background: #f3f3f3;
}

body[data-theme="light"] .texture-bake-popup__option-btn.is-active {
  background: #e8e8e8;
  border-color: #c2c2c2;
}

body[data-theme="light"] .texture-bake-popup__text {
  color: #444444;
}

body[data-theme="light"] .resource-importer-popup__add-btn {
  border-color: #d0d0d0;
  background: #ffffff;
  color: #111111;
}

body[data-theme="light"] .resource-importer-popup__add-btn:hover {
  background: #f3f3f3;
}

body[data-theme="light"] .resource-importer-popup__list {
  border-color: #d0d0d0;
  background: #f8f8f8;
  color: #666666;
}

body[data-theme="light"] .resource-importer-popup__row-name {
  color: #111111;
}

body[data-theme="light"] .resource-importer-popup__row-type {
  border-color: #d0d0d0;
  background: #ffffff;
  color: #111111;
}

body[data-theme="light"] .resource-importer-popup__row-remove {
  border-color: #d0d0d0;
  background: #ffffff;
  color: #111111;
}

body[data-theme="light"] .resource-importer-popup__row-remove:hover {
  background: #f3f3f3;
}

body[data-theme="light"] .tt-bake-cage-legend {
  border-color: rgba(40, 40, 40, 0.2);
  background: rgba(252, 252, 252, 0.9);
  color: #1f1f1f;
}

body[data-theme="light"] .paint-color-popover__title {
  color: #334155;
}

body[data-theme="light"] .paint-color-popover__color {
  border-color: #e8e8e8;
}

body[data-theme="light"] .tool-context-menu {
  background: #fcfcfc;
  border-color: #e8e8e8;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

body[data-theme="light"] .tool-option {
  color: #262626;
}

body[data-theme="light"] .tool-option:hover {
  background: #e8e8e8;
}

body[data-theme="light"] .tt-pane {
  background: #fcfcfc;
}

body[data-theme="light"] .tt-layer-row {
  background: #fcfcfc;
  color: #262626;
  border-color: #e8e8e8;
}

body[data-theme="light"] .tt-layer-row:hover,
body[data-theme="light"] .tt-layer-row.is-active {
  background: #e8e8e8;
}

@media (max-width: 900px) {
  .panel-toolbar {
    min-height: 40vh;
  }

  .panel-sidebar {
    width: 220px;
  }

  .app-root[data-current-tool="bake"] .panel-sidebar {
    width: 248px;
  }
}

/* —— Account / Firebase auth (menu bar + modal) —— */
.menu-bar-auth {
  margin-left: auto;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding-right: 10px;
  position: relative;
  z-index: 2;
  min-width: 0;
}

.menu-bar-auth__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 220px;
  overflow: hidden;
}

.menu-bar-auth__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-bar-auth__btn .ph-user-square {
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1;
}

body[data-theme="light"] .menu-bar-auth__btn .ph-user-square {
  color: inherit;
}

.trumble-auth-popup {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(340px, calc(100vw - 24px));
  /* Keep auth/account modal above all tool popups and overlays. */
  z-index: 20050;
}

.trumble-auth-popup__header {
  cursor: default;
}

.trumble-auth-popup__body {
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: 12px 14px;
}

/* Bake popups use a 3-column grid for .texture-bake-popup__actions; auth has one or two full-width rows. */
.trumble-auth-popup .texture-bake-popup__actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  grid-template-columns: none;
}

.trumble-auth-popup .texture-bake-popup__actions .texture-bake-popup__action-btn {
  width: 100%;
  box-sizing: border-box;
}

.trumble-auth__notice {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.45;
  color: #c8c8c8;
}

.trumble-auth__code {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  background: #1a1a1a;
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid #404040;
}

.trumble-auth__tabs {
  display: flex;
  gap: 0;
  margin-bottom: 10px;
  border-bottom: 1px solid #404040;
}

.trumble-auth__tab {
  flex: 1;
  min-height: 30px;
  padding: 6px 8px;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: #a8a8a8;
  font-size: 12px;
  cursor: pointer;
}

.trumble-auth__tab:hover {
  color: #dddddd;
  background: #2f2f2f;
}

.trumble-auth__tab--active {
  color: #f0f0f0;
  font-weight: 600;
  border-bottom-color: #60a5fa;
}

.trumble-auth__actions {
  margin-top: 4px;
}

.trumble-auth__actions--stack {
  flex-direction: column;
  align-items: stretch;
}

.trumble-auth__actions--stack .texture-bake-popup__action-btn {
  width: 100%;
}

.trumble-auth__separator {
  text-align: center;
  font-size: 11px;
  color: #888;
  margin: 6px 0;
}

.trumble-auth__hint {
  margin: 0 0 8px;
  font-size: 11px;
  line-height: 1.4;
  color: #909090;
}

.trumble-auth__hint--tight {
  margin-bottom: 6px;
}

body[data-theme="light"] .trumble-auth__hint {
  color: #666;
}

.trumble-auth__google-btn {
  width: 100%;
  margin-top: 8px;
}

.trumble-auth__error {
  margin: 0;
  font-size: 12px;
  color: #f87171;
}

.trumble-auth__signed-in-label {
  margin-bottom: 4px;
}

.trumble-auth__account-email {
  margin: 0 0 12px;
  font-size: 12px;
  color: #e8e8e8;
  word-break: break-all;
}

.trumble-auth__drive-label {
  margin-bottom: 4px;
}

.trumble-auth__drive-status {
  margin: 0 0 10px;
  font-size: 12px;
  color: #b0b0b0;
  line-height: 1.4;
}

body[data-theme="light"] .trumble-auth__notice {
  color: #404040;
}

body[data-theme="light"] .trumble-auth__code {
  background: #f0f0f0;
  border-color: #e8e8e8;
  color: #262626;
}

body[data-theme="light"] .trumble-auth__tabs {
  border-bottom-color: #e8e8e8;
}

body[data-theme="light"] .trumble-auth__tab {
  color: #666;
}

body[data-theme="light"] .trumble-auth__tab:hover {
  color: #262626;
  background: #eee;
}

body[data-theme="light"] .trumble-auth__tab--active {
  color: #111;
  border-bottom-color: #2563eb;
}

body[data-theme="light"] .trumble-auth__separator {
  color: #888;
}

body[data-theme="light"] .trumble-auth__account-email {
  color: #262626;
}

body[data-theme="light"] .trumble-auth__drive-status {
  color: #444;
}

