:root {
  /* Light mode colors */
  --background-color: #ffffff;
  --text-color: #333;
  --highlight-color: #e6e6e6;
  --input-bg-color: #f0f0f0;
  --amorphic-color: #181818;
  --main-bg-color: #f0f0f0;
  --canvas-bg-color: #e5e5e5;
  --svg-preview-bg: #d6d6d6;
  --border-color: #bababa;
  --border-subtle: #e5e5e5;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --shadow-subtle: rgba(0, 0, 0, 0.05);
  --code-editor-bg: white;
  --button-bg: #d7d7d7;
  --button-hover-bg: var(--highlight-color);
  --button-emphasized-bg: #6b9bb3;
  --properties-panel-bg: #f5f5f5;
  --layer-bg: #f9f9f9;
  --layer-sub-bg: #efefef;
  --layer-over-bg: #e7f3ff;
  --layer-over-border: #007bff;
  --text-muted: #777;
  --text-secondary: #000000;
  --accordion-after: #777;
  --menu-bg: white;
  --item-browser-bg: white;
  --item-browser-border: #dfdfdf;
  --ai-modal-bg: white;
  --ai-modal-right-bg: #f9f9f9;
  --ai-modal-right-border: #e0e0e0;
  --3d-bg-color: #e5e5e5;

  /* Scrollbar colors for light mode */
  --scrollbar-thumb: #c0c0c0;
  --scrollbar-thumb-hover: #a0a0a0;
  --scrollbar-track: #f0f0f0;
}

[data-theme="dark"] {
  /* Dark mode colors */
  --background-color: #1e1e1e;
  --text-color: #e0e0e0;
  --highlight-color: #3a3a3a;
  --input-bg-color: #2a2a2a;
  --amorphic-color: #181818;
  --main-bg-color: #121212;
  --canvas-bg-color: #323131;
  --svg-preview-bg: #3d3c3c;
  --border-color: #555;
  --border-subtle: #333;
  --shadow-color: rgba(0, 0, 0, 0.5);
  --shadow-subtle: rgba(0, 0, 0, 0.3);
  --code-editor-bg: #252525;
  --button-bg: #3a3a3a;
  --button-hover-bg: #4a4a4a;
  --button-emphasized-bg: #6b9bb3;
  --properties-panel-bg: #252525;
  --layer-bg: #2a2a2a;
  --layer-sub-bg: #242424;
  --layer-over-bg: #1e3a5e;
  --layer-over-border: #4a9eff;
  --text-muted: #aaa;
  --text-secondary: #8f8d8d;
  --accordion-after: #aaa;
  --menu-bg: #252525;
  --item-browser-bg: #252525;
  --item-browser-border: #444;
  --ai-modal-bg: #2a2a2a;
  --ai-modal-right-bg: #242424;
  --ai-modal-right-border: #3a3a3a;
  --3d-bg-color: #333333;

  /* Scrollbar colors for dark mode */
  --scrollbar-thumb: #555;
  --scrollbar-thumb-hover: #666;
  --scrollbar-track: #2a2a2a;
}

body {
  color: var(--text-color);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  overflow: hidden;
}

/* Custom Scrollbar Styling */
/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 6px;
}

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

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

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

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

#logo-image {
  width: 164px;
}


.dt-main {
  left: 0px;
  top: 0px;
  width: 100%;
  height: 100%;
  position: absolute;
  background-color: var(--main-bg-color);
  display: flex;
}

.dt-tools {
  width: 100%;
  height: 60px;
  background-color: var(--properties-panel-bg);
  display: flex;
  position: relative;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  -webkit-box-shadow: 0px 0px 4px 0px var(--shadow-subtle);
  box-shadow: 0px 0px 4px 0px var(--shadow-subtle);
  z-index: 1;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 4px;
  gap: 4px;
  flex-wrap: nowrap;
}

/* Medium screens: micro icons, single row, scrollable */
@media (max-width: 1200px) {
  .dt-tools {
    height: 50px;
  }
}

/* Small screens: micro icons, allow wrapping to 2 rows */
@media (max-width: 768px) {
  .dt-tools {
    height: auto;
    min-height: 50px;
    max-height: 100px;
    flex-wrap: wrap;
    overflow-y: auto;
    gap: 2px;
    padding: 2px;
  }
}

.am-canvas {
  width: 100%;
  height: 100%;
  background-color: var(--canvas-bg-color);
  /* display: block; */
  position: relative;
  overflow: auto;
  /* top:30px; */
  display: flex;
  align-items: center;
  /* justify-items: center; */
  justify-content: center;
}

.rightJustify {
  justify-content: flex-end;
}

.dt-topbar {
  width: 100%;
  height: 40px;
  background-color: var(--background-color);
  display: flex;
  position: absolute;
  top: 0px;
  left: 0px;
  z-index: 1002;
  align-items: center;
  justify-content: space-between;
  /* text-transform: uppercase; */
  margin: 0;
  -webkit-font-smoothing: antialiased;
  /* color: #bababa; */
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.1rem;
  font-weight: 600;
  /* font-family: 'Inter', sans-serif; */
  color: var(--text-color);
  -webkit-box-shadow: 0px 0px 6px 1px var(--shadow-color);
  box-shadow: 0px 0px 6px 1px var(--shadow-color);
}

.dark-mode-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 10px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-color);
  padding: 0;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.dark-mode-toggle:hover {
  opacity: 1;
}

.dark-mode-toggle .material-icons {
  font-size: 20px;
}

.help-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-right: 10px;
  padding: 4px 8px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-color);
  opacity: 0.7;
  transition: opacity 0.2s;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1rem;
  text-transform: uppercase;
}

.help-link:hover {
  opacity: 1;
  background-color: var(--highlight-color, rgba(0, 0, 0, 0.05));
}

.help-link .material-icons {
  font-size: 18px;
}

.help-link .help-text {
  font-family: inherit;
}

.language-select {
  margin-right: 10px;
  padding: 4px 8px;
  background-color: var(--background-color);
  color: var(--text-color);
  border: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
  border-radius: 4px;
  font-size: 1em;
  font-weight: 600;
  letter-spacing: 0.05rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s, border-color 0.2s;
  outline: none;
}

.language-select:hover {
  opacity: 1;
  border-color: var(--text-color);
}

.language-select:focus {
  opacity: 1;
  border-color: var(--text-color);
}

.am-topbar {
  width: 100%;
  height: 30px;
  background-color: var(--amorphic-color);
  display: flex;
  position: absolute;
  top: 0px;
  left: 0px;
  z-index: 100;
  align-items: center;
  justify-content: space-around;
  /* text-transform: uppercase; */
  margin: 0;
  -webkit-font-smoothing: antialiased;
  /* color: #bababa; */
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.1rem;
  font-weight: 600;
  /* font-family: 'Inter', sans-serif; */
}


.dt-properties-panel {
  width: 300px;
  height: calc(100% - 30px);
  top: 40px;
  position: relative;
  background-color: var(--background-color);
  display: flex;
  flex-direction: column;
  /* align-items: center; */
  padding: 10px;
  /* color:#bababa; */
  /* font-family: sans-serif; */
  font-size: 12px;
  -webkit-box-shadow: 0px 0px 6px 1px rgb(0 0 0 / 10%);
  z-index: 115;
  box-shadow: 0px 0px 6px 1px rgb(0 0 0 / 10%);
  overflow-y: auto;
}

.dt-properties {
  display: flex;
  flex-direction: column;
  /* -webkit-box-shadow: 0px 0px 6px 1px rgb(0 0 0 / 10%); */
  /* box-shadow: 0px 0px 6px 1px rgb(0 0 0 / 10%); */
  /* padding: 10px; */
  /* border-bottom: 1px solid #bababa; */
}

.dt-canvas {
  width: 50%;
  height: 100%;
  background-color: var(--canvas-bg-color);
  /* display: block; */
  position: relative;
  overflow: auto;
  /* top:30px; */
  display: flex;
  align-items: center;
  /* justify-items: center; */
  /* justify-content: center; */
}

.dt-navigation-menu {
  position: fixed;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 1000;
  background-color: var(--background-color);
  border-radius: 4px;
  padding: 4px;
  box-shadow: 0 2px 8px var(--shadow-color);
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
}

.dt-nav-button {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.15s ease;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
}

.dt-nav-button:hover {
  background-color: var(--highlight-color);
}

.dt-nav-button img {
  width: 20px;
  height: 20px;
  pointer-events: none;
  filter: brightness(0) saturate(100%) invert(20%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
}

[data-theme="dark"] .dt-nav-button img {
  filter: brightness(0) saturate(100%) invert(90%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
}

.edit-buttons {
  display: flex;
  position: fixed;
  /* Changed to fixed for dynamic positioning */
  /* bottom: 13px; */
  /* left: 110px; */
  z-index: 115;
  background-color: var(--background-color);
  -webkit-box-shadow: 0px 0px 6px 1px var(--shadow-color);
  box-shadow: 0px 0px 6px 1px var(--shadow-color);
  align-content: center;
  align-items: center;
  padding: 4px;
  font-size: 12px;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  /* margin-top: 10px; */
  /* Removed margin as it's fixed now */
  border-radius: 4px;
  /* Add radius for better look */
}

.code-editor {
  display: none;
  position: absolute;
  top: 10px;
  left: 43px;
  width: calc(100% - 100px);
  /* height: 100%; */
  padding: 20px;
  background: var(--code-editor-bg);
  -webkit-box-shadow: 0px 0px 6px 1px var(--shadow-color);
  box-shadow: 0px 0px 6px 1px var(--shadow-color);
  color: var(--text-color);
}

.tool-button {
  min-width: 50px;
  height: calc(100% - 8px);
  background-color: var(--properties-panel-bg);
  margin: 0 2px;
  padding: 6px 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  flex-direction: column;
  font-size: 10px;
  border-radius: 4px;
  transition: background-color 0.15s ease;
  flex-shrink: 0;
  -webkit-user-select: none;
  user-select: none;
}

.tool-button:hover {
  background-color: var(--highlight-color);
}

.tool-button:active {
  background-color: var(--highlight-color);
  opacity: 0.8;
}

/* Medium screens: smaller buttons with smaller labels */
@media (max-width: 1200px) {
  .tool-button {
    min-width: 40px;
    height: 42px;
    padding: 3px 2px;
    font-size: 7px;
  }

  .tool-button .menu-lable {
    font-size: 7px;
    line-height: 1;
    margin-top: 1px;
  }
}

/* Small screens: even smaller for 2-row layout */
@media (max-width: 768px) {
  .tool-button {
    min-width: 36px;
    height: 40px;
    padding: 2px 1px;
    margin: 0 1px;
    font-size: 6px;
  }

  .tool-button .menu-lable {
    font-size: 6px;
    line-height: 1;
    margin-top: 1px;
  }
}

.svg-icon {
  filter: brightness(0) saturate(100%) invert(78%) sepia(3%) saturate(12%) hue-rotate(0deg) brightness(15%) contrast(86%);
  pointer-events: none;
  display: flex;
  align-content: center;
  justify-content: center;
  margin-bottom: 2px;
  flex-shrink: 0;
}

[data-theme="dark"] .svg-icon {
  filter: brightness(0) saturate(100%) invert(90%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
}

.svg-icon img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

/* Medium screens: smaller icons */
@media (max-width: 1200px) {
  .svg-icon {
    margin-bottom: 0;
  }

  .svg-icon img {
    width: 18px;
    height: 18px;
  }
}

/* Small screens: even smaller icons for 2-row layout */
@media (max-width: 768px) {
  .svg-icon img {
    width: 16px;
    height: 16px;
  }
}

h3 {

  margin: 0;
  -webkit-font-smoothing: antialiased;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.1rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
}

.property-label {
  font-size: 12px;
  font-weight: 500;
  margin-right: 10px;
}

.tool-hr {
  border: none;
  border-left: 1px solid var(--border-subtle);
  width: 0;
  height: calc(100% - 16px);
  margin: 0 4px;
  flex-shrink: 0;
}

/* Hide dividers on small screens to save space */
@media (max-width: 768px) {
  .tool-hr {
    display: none;
  }
}

svg .rotate {
  transform-box: fill-box;
  transform-origin: center;
  transform: rotate(45deg);
}

.draggable {
  cursor: url("/icons/cursor-move.svg"), move;
}

.rotateable {
  cursor: url("/icons/rotate_90_degrees_cw.svg"), auto;
}


.svg-preview {
  background-color: var(--svg-preview-bg);
  width: 100%;
  height: 100%;
  position: absolute;
  user-select: none;
  overflow: hidden;
}

/* The SVG inside svg-preview is 4096x4096 but scaled to fit */
.svg-preview>svg {
  width: 4096px;
  height: 4096px;
  transform-origin: 0 0;
  /* Scale is set dynamically via JS based on container size */
}

/* Fix for clip-path: override browser's user-agent transform-origin on SVG children
   The browser's :not(svg) rule sets transform-origin: 0 0 which breaks clip-path */
.svg-preview svg [clip-path],
.svg-preview svg clipPath,
.svg-preview svg clipPath * {
  transform-origin: 0 0;
  transform-box: fill-box;
}

.crosshair {
  cursor: crosshair;
}

.bezier-handle {
  cursor: move;
  fill: #83b6c0;
  stroke: #FFF;
  stroke-width: 0.1;
  r: 0.2;
}

.bezier-handle-line {
  stroke: #83b6c0;
  fill: none;
  stroke-width: 0.1;
}

.pattern-piece {
  /* stroke: var(--highlight-color); */
  /* stroke-width: 0.1; */
}

.pattern-piece-pool {
  stroke: #cf5e5e;
  fill: #83e89f0e;
  stroke-width: 0.1;
}

.non-interactive {
  pointer-events: none;
}

.view-buttons {
  display: flex;
  width: 210px;
  justify-content: center;
  margin-left: 67px;
}


.dt-view {
  width: 100%;
  height: calc(100% - 60px);
  background-color: var(--background-color);
  display: flex;
  position: relative;
  /* overflow: auto; */
}

/* Adjust view height when toolbar wraps */
@media (max-width: 1024px) {
  .dt-view {
    height: calc(100% - 120px);
    /* Account for potential 2-row toolbar */
  }
}

.dt-left-container {
  display: flex;
  flex-direction: column;
  width: calc(100% - 300px);
  height: calc(100% - 40px);
  position: relative;
  top: 40px;
}

.dt-3d {
  width: 50%;
  position: relative;
  /* right: 0; */
  height: 100%;
  z-index: 99;
  display: flex;
  justify-content: center;
  align-items: center;
}

.fan-button-row {
  display: flex;
  justify-content: space-around;
  margin-top: 8px;
  margin-bottom: 8px;
  gap: 4px;
  border-bottom: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.1));
  padding-bottom: 6px;
}

.fan-bt,
.view-bt {
  background-color: var(--background-color);
  color: var(--text-color);
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
  align-items: center;
  text-align: center;
  font-size: 0.85em;
  letter-spacing: 0.05em;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  transition: background-color 0.15s ease;
  border: 1px solid transparent;
}

.fan-bt h3,
.view-bt {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
  font-family: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
}

.fan-bt:hover,
.view-bt:hover {
  background-color: var(--highlight-color);
}

.fan-bt:active,
.view-bt:active {
  background-color: var(--highlight-color);
  opacity: 0.9;
}

.fan-bt-selected {
  background-color: var(--highlight-color);
  border-color: var(--border-color);
  font-weight: 700;
}

.layer-div {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color 0.15s ease;
}

.layer-div:hover {
  background-color: var(--highlight-color);
}

.layer-div:last-child {
  border-bottom: none;
}

.sub-layer {
  padding-left: 20px;
}

.visibility-button {
  background-color: transparent;
  color: var(--text-color);
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  align-items: center;
  text-align: center;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.visibility-button:hover {
  background-color: var(--highlight-color);
  border-color: var(--border-color);
}

.layer-title {
  color: var(--text-color);
  font-size: 0.875em;
  margin-left: 10px;
  user-select: none;
  pointer-events: none;
  font-weight: 500;
}

.fake-cursor {
  position: absolute;
  width: 30px;
  height: 30px;
  pointer-events: none;
  z-index: 1000;
}

.color-picker-box {
  position: relative;
  width: 20px;
  height: 20px;
  border: solid 1px;
  margin: 2px;
  justify-self: right;
  cursor: pointer;
}

.pantone-color-btn {
  width: 30px;
  height: 30px;
  border-radius: 15px;
  margin: 5px;
  cursor: pointer;
  /* border: 1px solid #bcbcbc; */
}

.color-pallet {
  padding: 10px;
  width: 200px;
  background-color: var(--background-color);
  position: fixed;
  display: flex;
  flex-wrap: wrap;
  pointer-events: all;
  -webkit-box-shadow: 0px 0px 4px 0px var(--shadow-subtle);
  box-shadow: 0px 0px 4px 0px var(--shadow-subtle);
  z-index: 10000;
}

.pantone-color-btn {
  width: 30px;
  height: 30px;
  border-radius: 15px;
  margin: 5px;
  cursor: pointer;
  /* border: 1px solid #bcbcbc; */
}

.color-picker-holder {
  display: flex;
  /* flex-wrap: wrap; */
  justify-content: center;
  align-items: center;
}

.menutitle {
  -webkit-font-smoothing: antialiased;
  color: var(--text-color);
  font-size: 0.875em;
  font-weight: 600;
  padding: 6px 0;
  margin-bottom: 4px;
  font-family: 'Inter', sans-serif;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.properties-panel {
  display: flex;
  flex-direction: column;
  padding: 12px;
  /* gap: 8px; */
}

.properties-input {
  display: flex;
  flex-direction: column;
  padding: 6px 8px;
  font-size: 1em;
  margin: 4px 0;
  border-radius: 4px;
  max-width: 108px;
  background-color: var(--input-bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.properties-input:focus {
  outline: none;
  border-color: var(--highlight-color);
  box-shadow: 0 0 0 2px var(--highlight-color, rgba(0, 123, 255, 0.25));
}

.properties-input::placeholder {
  color: var(--text-muted);
}

.properties-button {
  display: flex;
  padding: 6px 12px;
  margin: 10px 0;
  border-radius: 4px;
  text-align: center;
  align-items: center;
  justify-content: center;
  background-color: var(--button-bg);
  border: 1px solid var(--border-color);
  cursor: pointer;
  color: var(--text-color);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.properties-button:hover {
  background-color: var(--button-hover-bg);
  opacity: 0.9;
}

.properties-button:active {
  opacity: 0.8;
}

.properties-button:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--highlight-color, rgba(0, 123, 255, 0.25));
}

.accordion-bt {
  -webkit-font-smoothing: antialiased;
  color: var(--text-color);
  text-transform: uppercase;
  font-size: 1em;
  letter-spacing: 0.05em;
  font-weight: 700;
  padding: 8px 10px;
  padding-left: 10px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  background-color: var(--background-color);
  border: 0;
  border-radius: 4px;
  margin-top: 6px;
  margin-bottom: 2px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.15s ease;
  width: 100%;
}

.active,
.panel-toggle:hover,
.panel-toggle:focus,
.accordion-bt:hover,
.accordion-bt:focus {
  background-color: var(--highlight-color);
  color: var(--text-color);
  border: 0px;
  outline: 0px;
}

.accordion-bt:after {
  content: '\002B';
  color: var(--accordion-after);
  font-weight: bold;
  float: right;
  margin-left: 8px;
  font-size: 1.1em;
}

.active:after {
  content: "−";
}

.panel {
  padding: 0px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease-out;
  flex-direction: column;
  align-items: normal;
  margin-bottom: 4px;
}

/* Add subtle divider between property sections */
.panel:not(:last-child) {
  border-bottom: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.05));
  padding-bottom: 4px;
}

.layer-type-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: 5px;
}

[data-theme="dark"] .layer-type-icon img {
  filter: brightness(0) saturate(100%) invert(90%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
}

.hide-totally {
  display: none !important;
}

.property-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 4px;
  margin: 2px 0;
}

.property-row label {
  font-size: 0.875em;
  color: var(--text-color);
  font-weight: 500;
}

.property-row input,
.property-row select {
  font-size: 1em;
}

.menu-fan {
  display: inline-flex;
  cursor: pointer;
  flex-direction: row;
  align-items: center;
  min-width: auto;
  position: relative;
  /* Required for dropdown positioning */
  z-index: 1003;
  padding: 6px 12px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  user-select: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-color);
  white-space: nowrap;
}

.menu-fan:hover {
  background-color: var(--highlight-color);
}

.menu-fan:active {
  background-color: var(--button-bg);
}

.menu-elements {
  display: none;
  /* Hidden by default, shown via JS */
  flex-direction: column;
  padding: 4px 0;
  margin-top: 0;
  background: var(--menu-bg);
  min-width: 180px;
  border-radius: 4px;
  box-shadow: 0 2px 8px var(--shadow-color);
  border: 1px solid var(--border-color);
  position: absolute;
  top: 100%;
  /* Position directly below the menu button */
  left: 0;
  z-index: 1004;
  /* Above the menu-fan */
  overflow: hidden;
  /* Clip hover effects to container bounds */
}

.menu-element {
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  color: var(--text-color);
  transition: background-color 0.1s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.menu-element:hover {
  background-color: var(--highlight-color);
}

.menu-element:active {
  background-color: var(--button-bg);
}

.menu-element .svg-icon {
  margin-bottom: 0;
  margin-right: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.menu-element .svg-icon img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.menu-element span {
  flex: 1;
  white-space: nowrap;
}

.menu-home {
  /* padding: 8px 12px; */
  cursor: pointer;
  /* border-radius: 6px; */
  height: 34px;
  width: 158px;
  margin-left: -11px;
  user-select: none;
  /* margin-left: 12px; */
  /* margin-right: 8px; */
  /* font-size: 14px; */
  /* font-weight: 500; */
  color: var(--text-color);
  transition: background-color 0.2s ease;
}

.menu-home:hover {
  background-color: var(--highlight-color);
}

.menu-home:active {
  background-color: var(--button-bg);
}

.fullscreen-dialogbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  font-family: 'Inter';
}

.login-container {
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0px;
  top: 0px;
  /* background-color: #f8f8f8; */
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-container h1 {
  font-size: 20px;
  text-align: center;
  text-transform: uppercase;
}

.login-box {
  background-color: var(--background-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-secondary);
  position: absolute;
  left: 50%;
  transform: translate(-50%, 0);
  padding: 10px;
  -webkit-box-shadow: 0px 0px 6px 1px var(--shadow-color);
  box-shadow: 0px 0px 6px 1px var(--shadow-color);
}

.login-box h4 {
  text-align: center;
  font-size: 16px;
  /* margin: 10px; */
  margin-block-end: 0px;
}

.top-logo {
  color: var(--action-color);

  justify-content: center;
  display: flex;
  padding-top: 60px;


}

.form-element {
  margin: 14px;
  text-align: center;
}

.form-button {
  text-align: center;

}

.login-close {
  position: fixed;
  top: 0px;
  right: 0px;
  margin: 5px;
  z-index: 301;
  cursor: pointer;
  fill: var(--text-secondary);
}

.login-close:hover {
  fill: var(--text-color) !important;
}

.active-engine-ui {
  display: flex;
  flex-direction: column;

}

.history-list-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px;
  cursor: pointer;
  background-color: var(--background-color);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  /* text-transform: uppercase; */
  letter-spacing: 0.1em;
  border: solid 1px var(--border-color);
  margin: 6px;
}

.history-list-button:hover {
  background-color: var(--highlight-color);
}

.history-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px;
  cursor: pointer;
  background-color: var(--background-color);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.horizonal-marker {
  cursor: ew-resize;
}

.vertical-marker {
  cursor: ns-resize;
}

.scale-marker {
  cursor: nw-resize;
}

.rotate-marker {
  cursor: url("/icons/rotate.svg") 12 12, auto;
}

.center-marker {
  cursor: move;
}

.plus-button {
  cursor: pointer;
  background-color: var(--background-color);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  position: relative;
  /* width: 20px; */
  /* height: 20px; */
  /* border: solid 1px; */
  margin: 5px;
  margin-right: 0px;
  justify-self: right;
}

.trim-preview {
  width: 128px;
  height: 128px;
  background-color: var(--background-color);
  border: solid 1px var(--border-color);
  display: flex;
  justify-content: space-between;
}

.half-bar {
  width: 50%;
  height: 100%;
  position: relative;
}

.third-bar {
  width: 33.33%;
  height: 100%;
  position: relative;
}

.menu-lable {
  text-align: center;
  pointer-events: none;
  font-size: 11px;
  line-height: 1.2;
  color: var(--text-secondary);
  margin-top: 2px;
  word-wrap: break-word;
  max-width: 100%;
  /* font-weight: 500; */
}

.button-selected {
  background-color: var(--highlight-color);
  color: var(--text-color);
}

.size-button {
  cursor: pointer;
  background-color: var(--input-bg-color);
  color: var(--text-color);
  font-size: 12px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  position: relative;
  /* width: 20px; */
  height: 20px;
  border: 0px;
  border-radius: 4px;
  margin: 5px;
  margin-right: 0px;
  justify-self: right;
}

.dt-divide {
  width: 6px;
  height: 100%;
  background-color: var(--border-color);
  cursor: col-resize;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
  z-index: 100;
}

.dt-divide:hover {
  background-color: var(--highlight-color);
}

.dt-divide.dragging {
  background-color: var(--highlight-color);
}



.dt-price {
  position: absolute;
  bottom: 0px;
  right: 0px;
  padding: 5px;
  background-color: var(--text-color);
  color: var(--background-color);
  font-size: 12px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border: solid 1px var(--border-color);
  margin: 6px;
  width: calc(100% - 24px);
  height: fit-content;
}

.price-quantity-row {
  display: flex;
  justify-content: space-between;
  flex-wrap: nowrap;
  align-items: center;
}

.price-display {
  font-size: 24px;
}

.quantity-select {
  border: solid 1px var(--border-color);
  /* margin-top: 7px; */
  background: var(--input-bg-color);
  color: var(--text-color);
}

.editable:hover {
  stroke: #c51616;
  stroke-width: 0.1;
}

.editing-shape {
  stroke: #c7d712;
  stroke-width: 0.1;
}

/* Properties Panel Styles */
#dt_properties {
  background-color: var(--properties-panel-bg);
  border-radius: 6px;
  padding: 12px;
  box-shadow: 0 1px 3px var(--shadow-subtle);
  border: 1px solid var(--border-subtle);
}

#shape-properties-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#shape-properties-form label {
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-color);
  font-size: 0.875em;
  display: block;
}

#shape-properties-form input,
#shape-properties-form select {
  margin-bottom: 0;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.875em;
  background-color: var(--input-bg-color);
  color: var(--text-color);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}

#shape-properties-form input:focus,
#shape-properties-form select:focus {
  outline: none;
  border-color: var(--highlight-color);
  box-shadow: 0 0 0 2px var(--highlight-color, rgba(0, 123, 255, 0.25));
}

#shape-properties-form select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 8px top 50%;
  background-size: 12px auto;
  padding-right: 28px;
}

#shape-properties-form input[type="number"] {
  width: 80px;
}

/* Form group spacing */
#shape-properties-form>div {
  margin-bottom: 8px;
}

#shape-properties-form>div:last-child {
  margin-bottom: 0;
}

.layer-assignment {
  display: flex;
  /* flex-direction: column; */
  align-items: center;
  padding: 8px;
  justify-content: space-around;
}

.palette-ui {
  position: absolute;
  z-index: 10000;
  background-color: var(--background-color);
  border: solid 1px var(--border-color);
  border-radius: 8px;
  padding: 10px;
  width: 329px;
  right: 318px;
  top: 42px;
  max-height: calc(100% - 162px);
  /* overflow-y: auto; */
  /* overflow-x: hidden; */
}

.color_block {
  width: 20px;
  height: 20px;

}

.palette_container {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  overflow: auto;
  max-height: 600px;
}

.palette_search {
  /* margin-bottom: 15px; */
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
  width: 159px;
  background-color: var(--input-bg-color);
  color: var(--text-color);
}

.palette_controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 57px;
}


.auto_close_label {
  font-size: 7px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: end;
  /* transform: translateY(-4px); */
}

.close-button {
  transform: translate(3px, -15px);
}

/* Shared Border Styles */
.dialog-border {
  border: solid 1px var(--border-color);
  border-radius: 8px;
}

.dialog-border-subtle {
  border-bottom: solid 1px var(--border-subtle);
}

.item-browser {
  position: absolute;
  z-index: 10000;
  background-color: var(--item-browser-bg);
  padding: 10px;
  width: 80%;
  right: 10%;
  top: 10%;
  max-height: 80%;
  max-width: 1200px;
  overflow-y: auto;
  -webkit-box-shadow: 0px 0px 4px 0px var(--shadow-subtle);
  box-shadow: 0px 0px 4px 0px var(--shadow-subtle);
  min-height: 500px;
}

.cat-con {
  border: 5px;
  box-shadow: 0 0 0 1px var(--item-browser-border);
  background: var(--menu-bg);
  margin: 7px;
  /* display: flex; */
  width: 69px;
  height: 103px;
  float: left;
  border-radius: 5px;
  padding: 5px;
  cursor: pointer;
  transition: 0.4s;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  text-align: center;
  font-size: 9px;
  justify-content: center;
  overflow: hidden;
  font-weight: 600;
  color: var(--text-color);
}

/* Desktop sync state on a library tile (see GraphicsBrowser.syncBadgeHTML) */
.cat-con:has(> .sync-badge) { position: relative; }
.cat-con .sync-badge {
    position: absolute;
    left: 4px;
    top: 4px;
    font-size: 12px;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    background: rgba(31, 41, 55, .85);
    color: #e5e7eb;
    pointer-events: none;
}
.cat-con .sync-badge.local { background: rgba(21, 128, 61, .85); }

.cat-con:hover {
  background-color: var(--highlight-color);
}

/* Drag and drop styles */
.cat-con.dragging {
  opacity: 0.5;
  cursor: move;
}

.cat-con.drag-over {
  background-color: var(--highlight-color);
  border: 2px solid var(--text-secondary);
  box-shadow: 0 0 10px var(--shadow-color);
}

.cat-con.draggable-graphic {
  cursor: grab;
}

.cat-con.draggable-graphic:active {
  cursor: grabbing;
}

/* Graphic thumbnails sit on a two-tone grey checkerboard so both white and black
   artwork stays visible on a white (light) or near-black (dark) tile. */
.cat-con.draggable-graphic .item-content img {
  border-radius: 3px;
  background-color: #c9c9c9;
  background-image:
    linear-gradient(45deg, #a9a9a9 25%, transparent 25%, transparent 75%, #a9a9a9 75%),
    linear-gradient(45deg, #a9a9a9 25%, transparent 25%, transparent 75%, #a9a9a9 75%);
  background-size: 10px 10px;
  background-position: 0 0, 5px 5px;
}

[data-theme="dark"] .cat-con.draggable-graphic .item-content img {
  background-color: #6e6e6e;
  background-image:
    linear-gradient(45deg, #545454 25%, transparent 25%, transparent 75%, #545454 75%),
    linear-gradient(45deg, #545454 25%, transparent 25%, transparent 75%, #545454 75%);
}


.item-browser-header {
  display: flex;
  justify-content: end;
  align-items: right;
  gap: 12px;
}

.top-bar-title {
  font-size: 18px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.1em;
  width: 100%;
  margin-left: 10px;
}

.pallet-item-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* padding: 0px; */
  flex-direction: column;
  position: relative;
  transform: translate(0px, -14px);
}

.item-content {
  display: flex;
  align-items: center;
  cursor: pointer;
  flex-direction: column;
}

.delete-button {
  opacity: 0.6;
  cursor: pointer;
  padding: 4px;
  position: relative;
  /* right: 0px; */
  text-align: end;
  transform: translate(6px, -7px);
}

.delete-button:hover {
  opacity: 1;
}

.delete-button img {
  width: 12px;
  height: 12px;
  pointer-events: none;
  filter: brightness(0) saturate(100%) invert(20%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
}

[data-theme="dark"] .delete-button img {
  filter: brightness(0) saturate(100%) invert(90%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
}

.top-but {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.15s ease;
}

.top-but:hover {
  background-color: var(--highlight-color);
}

.top-but img {
  width: 25px;
  height: 25px;
  pointer-events: none;
  filter: brightness(0) saturate(100%) invert(20%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
}

[data-theme="dark"] .top-but img {
  filter: brightness(0) saturate(100%) invert(90%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
}

.top-bar-title img {
  transform: translate(0px, 3px);
  margin-right: 5px;
}

/* Save Dialog Styles */
.save-dialog {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  font-family: 'Inter', sans-serif;
}

.save-dialog-container {
  background-color: var(--item-browser-bg);
  padding: 0;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  box-shadow: 0px 0px 4px 0px var(--shadow-subtle);
  overflow: hidden;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.save-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: var(--background-color);
  cursor: move;
}

.save-dialog-title {
  font-size: 18px;
  font-weight: 800;
  font-family: 'Inter', sans-serif;
  /* letter-spacing: 0.1em; */
  color: var(--text-color);
  display: flex;
  align-items: center;
}

.save-dialog-title svg {
  filter: brightness(0) saturate(100%) invert(20%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
  margin-right: 8px;
  vertical-align: middle;
}

[data-theme="dark"] .save-dialog-title svg {
  filter: brightness(0) saturate(100%) invert(90%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
}

.save-dialog-close {
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-color);
}

.save-dialog-close:hover {
  background-color: var(--highlight-color);
}

.save-dialog-close svg {
  width: 24px;
  height: 24px;
  pointer-events: none;
  filter: brightness(0) saturate(100%) invert(20%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
}

[data-theme="dark"] .save-dialog-close svg {
  filter: brightness(0) saturate(100%) invert(90%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
}

.save-dialog-content {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.save-dialog-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.save-dialog-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-color);
  margin: 0;
  padding-bottom: 8px;
}

.save-dialog-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
}

.save-dialog-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 300px;
}

.save-dialog-input {
  width: 100%;
  max-width: 355px;
  padding: 10px 12px;
  border: solid 1px var(--border-color);
  border-radius: 4px;
  background-color: var(--input-bg-color);
  color: var(--text-color);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.save-dialog-input:focus {
  outline: none;
  border-color: var(--text-secondary);
  background-color: var(--background-color);
}

.save-dialog-checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.save-dialog-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--text-secondary);
}

.save-dialog-label {
  font-size: 14px;
  color: var(--text-color);
  cursor: pointer;
  user-select: none;
}

.save-dialog-button {
  padding: 10px 24px;
  background-color: var(--button-bg);
  color: var(--text-color);
  border: solid 1px var(--border-color);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background-color 0.15s ease;
  align-self: flex-start;
}

.save-dialog-button:hover {
  background-color: var(--button-hover-bg);
}

.save-dialog-button:active {
  background-color: var(--highlight-color);
}

.save-dialog-select {
  width: 100%;
  padding: 8px;
  border: solid 1px var(--border-color);
  border-radius: 4px;
  background-color: var(--input-bg-color);
  color: var(--text-color);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  overflow-y: auto;
}

.save-dialog-select:focus {
  outline: none;
  border-color: var(--text-secondary);
  background-color: var(--background-color);
}

.save-dialog-select option {
  padding: 6px;
  background-color: var(--background-color);
  color: var(--text-color);
}

.save-dialog-messages {
  padding: 10px;
  border-radius: 4px;
  font-size: 14px;
  visibility: hidden;
  min-height: 20px;
}

.save-dialog-search-clear {
  transition: opacity 0.15s ease;
}

.save-dialog-search-clear:hover {
  opacity: 0.7;
}

.scaling-engine {
  padding: 15px;
  font-family: Arial, sans-serif;
}

.scaling-header {
  margin-bottom: 15px;
  font-size: 14px;
  line-height: 1.4;
}

.scaling-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 62px;
  margin: 0 auto 15px auto;
}

.radio-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.clear-scaling {
  display: block;
  margin: 0 auto 15px auto;
  padding: 5px 15px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--button-bg);
  color: var(--text-color);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.clear-scaling:hover {
  background-color: var(--button-hover-bg);
}

.scaling-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-row label {
  font-size: 0.875em;
  cursor: pointer;
  color: var(--text-color);
  font-weight: 500;
}

.master-dimension {
  display: flex;
  gap: 20px;
  margin-top: 5px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 5px;
}

input[type="radio"],
input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.layer-div {
  padding: 5px;
  border: 1px solid var(--border-color);
  margin-bottom: 3px;
  background-color: var(--layer-bg);
  cursor: grab;
  display: flex;
  /* Use flexbox for alignment */
  align-items: center;
  /* Center items vertically */
  gap: 5px;
  /* Add space between button and title */
}

.layer-div.sub-layer {
  /* Indentation is now handled by inline style in createLayerItem */
  /* padding-left: 25px; */
  /* Remove if using inline style */
  background-color: var(--layer-sub-bg);
  /* Slightly different background for sub-layers */
}

.layer-div.text-layer {
  /* Specific styles for text layers if needed */
}

.layer-div.over {
  border-color: var(--layer-over-border);
  background-color: var(--layer-over-bg);
}

.layer-div:active {
  cursor: grabbing;
}

.layer-title {
  flex-grow: 1;
  /* Allow title to take remaining space */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Prevent long titles from breaking layout */
}

.visibility-button {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: flex;
  /* Ensure icon inside is aligned */
  align-items: center;
  justify-content: center;
  width: 20px;
  /* Fixed width for alignment */
  height: 20px;
  /* Fixed height */
}

.visibility-button .svg-icon img {
  display: block;
  /* Prevent extra space below image */
}

.layer-title-pattern-piece {
  font-weight: bold;
}

.embroidery-engine {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.settings-div {
  position: absolute;
  z-index: 10000;
  background-color: var(--background-color);
  /* border: solid 1px #bababa; */
  /* border-radius: 8px; */
  padding: 10px;
  width: 263px;
  right: 10px;
  top: 42px;
  max-height: calc(100% - 162px);
  /* overflow-y: auto; */
  /* overflow-x: hidden; */
  box-shadow: rgb(40 42 49 / 16%) 0px 1px 2px 0px;
}

.settings-div h2 {
  font-size: 18px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.1em;
  width: 100%;
}

.settings-button {
  width: 20px;
  height: 20px;
  cursor: pointer;
  padding: 5px;
  cursor: pointer;
}

.ai-studio-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--ai-modal-bg);
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px var(--shadow-color);
  z-index: 10000;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  resize: both;
  min-width: 600px;
  /* Or whatever minimum you prefer */
  min-height: 400px;
  color: var(--text-color);
}

.resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  background-image: linear-gradient(135deg, transparent 0%, transparent 50%, #888 50%, #888 100%);
  background-size: 8px 8px;
  background-repeat: no-repeat;
  background-position: bottom right;
}

.ai-studio-modal-prompt {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  margin-bottom: 10px;
}

.ai-studio-modal-prompt input {
  width: calc(100% - 50px);
  padding: 10px;
  border-radius: 5px;
  border: 1px solid var(--border-color);
  margin-bottom: 10px;
  background-color: var(--input-bg-color);
  color: var(--text-color);
}

.ai-studio-modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ai-studio-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 20px;
}

.ai-studio-modal-body {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  width: 100%;
  gap: 20px;
}

.ai-studio-left-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.ai-studio-right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 400px;
  max-height: 700px;
  border: 2px solid var(--ai-modal-right-border);
  border-radius: 8px;
  background-color: var(--ai-modal-right-bg);
  padding: 15px;
}

.document-header {
  border-bottom: 2px solid var(--layer-over-border);
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.document-header h3 {
  margin: 0;
  color: var(--text-color);
  font-size: 18px;
  font-weight: 600;
}

.document-content {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  align-content: flex-start;
}

.document-image-item {
  position: relative;
  /* background: white; */
  /* border-radius: 8px; */
  /* padding: 10px; */
  /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); */
}

.document-image-item img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}

.document-remove-button {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(255, 0, 0, 0.8);
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

.document-remove-button:hover {
  background: rgba(255, 0, 0, 1);
}

.ai-studio-modal-button {
  margin-right: 10px;
  padding: 8px 16px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.ai-studio-modal-button:hover {
  background: #0056b3;
}

.ai-studio-modal-button:disabled {
  background: #cccccc;
  cursor: not-allowed;
}

.animation-spin {
  background-color: #FFFFFF !important;
  color: #252525 !important;
}

.ai-studio-modal-preview {
  width: 512px;
  height: 512px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  background: var(--canvas-bg-color);
}

.ai-studio-modal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
}

.camera-button-array {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  position: absolute;
  gap: 10px;
  bottom: 20px;
  background-color: var(--background-color);
  -webkit-box-shadow: 0px 0px 6px 1px var(--shadow-color);
  box-shadow: 0px 0px 6px 1px var(--shadow-color);
}

.size-button-highlight {
  background-color: var(--highlight-color);
  color: var(--text-color);
}

[data-theme="dark"] .size-button-highlight {
  background-color: #4a4a4a;
}







.choice-dialog {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.choice-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.choice-dialog-content {
  background: var(--background-color);
  padding: 24px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  min-width: 300px;
  border: 1px solid var(--border-color);
}

.choice-dialog-title {
  margin: 0 0 16px 0;
  font-size: 18px;
  color: var(--text-color);
  font-weight: 600;
}

.choice-dialog-description {
  margin: 0 0 20px 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.choice-dialog-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-dialog-button {
  padding: 12px 20px;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.choice-dialog-button:hover {
  opacity: 0.9;
}

.choice-dialog-button.primary {
  background: #007bff;
}

.choice-dialog-button.success {
  background: #28a745;
}

.choice-dialog-button.secondary {
  background: var(--button-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.choice-dialog-button.secondary:hover {
  background: var(--button-hover-bg);
}

.choice-dialog-button-hint {
  font-size: 12px;
  opacity: 0.8;
  margin-left: 4px;
}

/* Available Modifiers settings panel (reuses .choice-dialog-overlay + .choice-dialog-button) */
.modifier-settings-dialog {
  background: var(--background-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  width: min(560px, 92vw);
  max-height: 80vh;
  overflow: auto;
  box-shadow: 0 4px 20px var(--shadow-color);
}

.modifier-settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
}

.modifier-settings-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.modifier-settings-close {
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.modifier-settings-body {
  padding: 12px 18px;
}

.modifier-settings-intro {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.modifier-settings-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
}

.modifier-settings-row input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--layer-over-border);
}

.modifier-settings-row-name {
  font-weight: 600;
}

.modifier-settings-row-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.modifier-settings-footer {
  display: flex;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border-color);
}

/* Scatter plugin — chosen-graphics list */
.scatter-graphic-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.scatter-graphic-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  font-size: 12px;
  background: var(--input-bg-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  max-width: 160px;
}

.scatter-graphic-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scatter-graphic-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 0;
}

.scatter-graphic-remove:hover {
  color: var(--text-color);
}

.gradient-tool-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  background-color: var(--background-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 6px var(--shadow-color);
  z-index: 10002;
  display: flex;
  flex-direction: column;
}

.gradient-tool-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  cursor: grab;
}

.gradient-tool-header h3 {
  margin: 0;
}

.gradient-tool-body {
  padding: 1rem;
  flex-grow: 1;
}

.gradient-tool-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  text-align: right;
}

.gradient-preview {
  width: 300px;
  height: 300px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin: 0 auto 1rem;
}

.gradient-controls .control-group {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
  gap: 0.5rem;
}

.gradient-controls .control-group label {
  flex-basis: 80px;
  flex-shrink: 0;
}

.gradient-controls .control-group input[type="range"] {
  flex-grow: 1;
}

.gradient-controls .control-group input[type="number"] {
  width: 60px;
}

.gradient-controls .radio-group {
  display: flex;
  gap: 1rem;
  margin-left: 1rem;
}

.hidden {
  display: none;
}

.stops-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.stop-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stop-item input[type="range"] {
  flex-grow: 1;
}





.remove-border-button {
  background: #ff4d4d;
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  font-weight: bold;
  margin-left: auto;
  padding: 0;
}

.style-editor-container {
  padding: 5px;
  border: 1px solid #444;
  border-radius: 4px;
  margin-top: 10px;
}

.style-grid-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.style-grid-row:first-child {
  margin-bottom: 5px;
}

.style-grid-row>div {
  flex: 1;
  text-align: center;
}

.style-grid-row label {
  font-weight: bold;
  font-size: 0.9em;
}

.style-grid-row .properties-input {
  width: 100%;
  box-sizing: border-box;
}

.add-border-button {
  width: 100%;
  margin-top: 10px;
}





/* Layer Menu specific styles */
.layer-div {
  display: flex;
  align-items: center;
  /* Vertically center all items */
  padding: 5px;
  border-bottom: 1px solid #4a4a4a;
  cursor: grab;
}

.layer-div:active {
  cursor: grabbing;
}

.layer-div>* {
  margin-right: 8px;
  /* Spacing between elements */
}

.layer-title {
  flex-grow: 1;
  /* Allows the title to take up remaining space */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Prevents long text from breaking layout */
  text-align: left;
}

.layer-div .visibility-button {
  background: none;
  border: none;
  padding: 0;
  margin: 0 4px;
  /* Give buttons a little breathing room */
  flex-shrink: 0;
  /* Prevent buttons from shrinking */
  cursor: pointer;
}

/* Push the 'Select' button to the far right */
.layer-div .visibility-button[title="Select this layer"] {
  margin-left: auto;
  /* This is the magic part */
  margin-right: 0;
  float: none;
  /* Override any old float properties */
}

/* Container for the left-side icons for fixed width alignment */
.layer-actions-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  /* Prevent this container from shrinking */
  width: 62px;
  /* Adjust this width as needed */
}

/* ColorDropDown Component Styles */
.color-dropdown {
  position: relative;
  cursor: pointer;
  user-select: none;
}

.color-dropdown-selected {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  min-height: 20px;
  background-color: var(--background-color);
  color: var(--text-color);
}

.color-dropdown-arrow {
  margin-left: auto;
  font-size: 0.8em;
  transition: transform 0.2s;
  color: var(--text-muted);
}

.color-dropdown-options {
  display: none;
  position: fixed;
  /* Fixed positioning when appended to body */
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  z-index: 10005;
  /* Higher than properties panel and other UI elements */
  box-shadow: 0 2px 8px var(--shadow-color);
  background-color: var(--background-color);
  color: var(--text-color);
}

.color-dropdown-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.15s;
}

.color-dropdown-option:hover {
  background-color: var(--highlight-color);
}

.color-dropdown-swatch {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
  border-radius: 2px;
}

.color-dropdown-placeholder {
  color: var(--text-muted);
}


/* IndexColorPicker Component Styles */
.index-color-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 8px;
}

.index-picker-container {
  width: 100%;
}

.icp-upload-area {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px;
}

.icp-upload-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  width: 100%;
  justify-content: center;
}

.icp-upload-button svg {
  flex-shrink: 0;
}

.icp-upload-button:hover {
  background-color: var(--highlight-color);
}

.icp-image-container {
  width: 100%;
  max-height: 200px;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--canvas-bg-color);
}

.icp-canvas-wrapper {
  display: inline-block;
  min-width: 100%;
  min-height: 100%;
}

.icp-canvas {
  display: block;
  cursor: crosshair;
}

.icp-zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
}

.icp-zoom-btn {
  padding: 4px 8px;
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icp-zoom-btn svg {
  pointer-events: none;
}

.icp-zoom-label {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 40px;
  text-align: center;
}

.icp-preview-area {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 4px;
  background-color: var(--layer-bg);
  border-radius: 4px;
}

.icp-color-section {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icp-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.icp-swatch {
  width: 24px;
  height: 24px;
  border: 1px solid var(--border-color);
  border-radius: 2px;
  background-color: var(--background-color);
}

.icp-value {
  font-size: 11px;
  color: var(--text-color);
  font-family: monospace;
  min-width: 60px;
}

.icp-delta-e {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
}

.icp-action-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.icp-confirm-btn,
.icp-clear-btn {
  padding: 6px 12px;
  font-size: 12px;
}

.icp-confirm-btn {
  background-color: var(--button-emphasized-bg);
  color: white;
  border: none;
}

.icp-confirm-btn:hover {
  opacity: 0.9;
}

/* Drag and drop visual feedback */
.icp-upload-area.drag-over {
  background-color: var(--highlight-color);
  border: 2px dashed var(--border-color);
  border-radius: 4px;
}

/* Texture Settings Panel */
.texture-settings-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--ai-modal-bg);
  color: var(--text-color);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 4px 20px var(--shadow-color);
  z-index: 10000;
  min-width: 300px;
}

.texture-settings-title {
  font-size: 1.1em;
  font-weight: 600;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.texture-settings-close {
  background: none;
  border: none;
  font-size: 1.4em;
  cursor: pointer;
  color: var(--text-color);
  opacity: 0.6;
  padding: 0 5px;
}

.texture-settings-close:hover {
  opacity: 1;
}

.texture-settings-group {
  margin-bottom: 15px;
}

.texture-settings-group label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.9em;
  color: var(--text-secondary);
}

.texture-size-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--input-bg-color);
  color: var(--text-color);
  font-size: 0.95em;
  cursor: pointer;
}

.texture-size-select:focus {
  outline: none;
  border-color: var(--button-emphasized-bg);
}

.texture-settings-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.texture-preset-btn {
  flex: 1;
  min-width: 60px;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--button-bg);
  color: var(--text-color);
  cursor: pointer;
  font-size: 0.85em;
  transition: all 0.2s;
}

.texture-preset-btn:hover {
  background: var(--button-hover-bg);
}

.texture-preset-btn.active {
  background: var(--button-emphasized-bg);
  color: white;
  border-color: var(--button-emphasized-bg);
}

.texture-auto-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 4px;
  background: var(--button-emphasized-bg);
  color: white;
  cursor: pointer;
  font-size: 0.95em;
  transition: background 0.2s;
}

.texture-auto-btn:hover {
  opacity: 0.9;
}

.texture-settings-info {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-secondary);
}

/* AI Studio Auto - Landscape Layout */
.ai-studio-floating-window .save-dialog-container {
  max-width: 970px;
}

.ai-studio-landscape-content {
  display: flex;
  flex-direction: row;
  gap: 20px;
}

.ai-studio-preview-panel {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-studio-controls-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 250px;
}

.ai-studio-prompt-textarea {
  width: 93%;
  min-height: 120px;
  padding: 10px 12px;
  border: solid 1px var(--border-color);
  border-radius: 4px;
  background-color: var(--input-bg-color);
  color: var(--text-color);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  resize: vertical;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ai-studio-prompt-textarea:focus {
  outline: none;
  border-color: var(--text-secondary);
  background-color: var(--background-color);
}

.ai-studio-prompt-textarea::placeholder {
  color: var(--text-muted);
}

.ai-studio-download-section {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

@media (max-width: 900px) {
  .ai-studio-landscape-content {
    flex-direction: column;
  }

  .ai-studio-preview-panel {
    width: 100%;
  }

  .ai-studio-controls-panel {
    min-width: auto;
  }
}

/* ==========================================================================
   PlaceHolder Tool
   ========================================================================== */

.placeholder-ui {
  padding: 10px;
}

.placeholder-ui h3 {
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: bold;
}

.placeholder-ui .placeholder-desc {
  font-size: 12px;
  color: var(--text-muted, #666);
  margin: 0 0 15px 0;
}

.placeholder-ui .placeholder-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted, #999);
  margin: 12px 0 6px 0;
}

.placeholder-ui .properties-button {
  width: 100%;
}

.placeholder-ui .placeholder-btn-badge {
  border-left: 3px solid #6366f1;
}

.placeholder-ui .placeholder-btn-main {
  border-left: 3px solid #2563eb;
}

.placeholder-ui .placeholder-btn-secondary {
  border-left: 3px solid #10b981;
}

.placeholder-ui .placeholder-divider {
  border: none;
  border-top: 1px solid var(--border-color, #ddd);
  margin: 15px 0;
}

.placeholder-element {
  transition: opacity 0.2s ease;
}

.placeholders-hidden .placeholder-element {
  display: none;
}

/* Tagify in save dialog */
.save-dialog-container .tagify {
  width: 100%;
  background: var(--bg-secondary, #2a2a2a);
  border: 1px solid var(--border-color, #444);
  border-radius: 4px;
  color: #fff;
}

.save-dialog-container .tagify__input {
  color: #fff;
}

.save-dialog-container .tagify__input::before {
  color: #888;
}

.save-dialog-container .tagify__tag {
  background: var(--accent-color, #6b9bb3);
  color: white;
}

.save-dialog-container .tagify__tag>div {
  color: white;
}

.save-dialog-container .tagify__dropdown {
  background: var(--bg-secondary, #2a2a2a);
  border: 1px solid var(--border-color, #444);
}

.save-dialog-container .tagify__dropdown__item {
  color: #fff;
}

.save-dialog-container .tagify__dropdown__item--active {
  background: var(--accent-color, #6b9bb3);
}
/* ---------------------------------------------------------------------------
   Unsaved changes.

   Shown as a badge next to DESIGNS plus a line along the foot of the bar, not
   as a colour wash over it: with no autosave the state is true for most of a
   working session, and a bar that is permanently red stops being read. The
   badge is clickable and saves, so the warning and the fix are one target.
   TemplateStudio.renderDirtyIndicator toggles .has-unsaved-changes on
   #dt_topbar, and also marks the tab title.
   --------------------------------------------------------------------------- */
.dt-unsaved-badge {
  display: none;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 10px;
  border-radius: 11px;
  background-color: var(--unsaved-color, #e8a33d);
  color: #23262b;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  align-self: center;
  flex: 0 0 auto;
  user-select: none;
}

.dt-unsaved-badge:hover {
  filter: brightness(1.08);
}

.dt-unsaved-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #23262b;
  flex: 0 0 auto;
}

.dt-topbar.has-unsaved-changes .dt-unsaved-badge {
  display: inline-flex;
}

/* A line along the foot of the bar: visible from the corner of the eye,
   without taking the bar over. */
.dt-topbar.has-unsaved-changes {
  box-shadow: inset 0 -2px 0 0 var(--unsaved-color, #e8a33d),
              0 0 6px 1px var(--shadow-color);
}

.dt-topbar.has-unsaved-changes #menu_save {
  font-weight: 600;
}

.dt-topbar.has-unsaved-changes #menu_save::after {
  content: '';
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-radius: 50%;
  background-color: var(--unsaved-color, #e8a33d);
  flex: 0 0 auto;
  align-self: center;
}

/* ---------------------------------------------------------------------------
   History panel (undo/redo).

   These rules existed only in ai_studio.css, so in the design tool the arrows
   had no fill and were invisible on the dark theme. Sizing differs too: that
   stylesheet positions the list as a floating menu, whereas #dt_history is a
   docked flex column.
   --------------------------------------------------------------------------- */
.history-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.history-highlight {
  background-color: var(--highlight-color);
  color: var(--text-color);
}

/* The redo tail: still reachable, but not where you are. */
.history-future {
  opacity: 0.45;
}

.history-saved::after {
  content: " •";
  opacity: 0.6;
}

.historyArrayButton {
  padding: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.historyArrayButton[aria-disabled="true"] {
  opacity: 0.35;
  cursor: default;
}

.history-icon {
  fill: var(--text-secondary);
}

.historyArrayButton:hover .history-icon {
  fill: var(--text-color);
}

/* Cut graphics wizard (public/js/cut/CutWizard.js) */
.cut-wizard-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.cut-wizard {
  background: var(--background-color, #fff);
  color: var(--text-color, #333);
  border: 1px solid var(--border-color, #bababa);
  border-radius: 8px;
  box-shadow: 0 4px 24px var(--shadow-color, rgba(0, 0, 0, 0.2));
  width: min(760px, 94vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  font-family: sans-serif;
  font-size: 14px;
}
.cut-wizard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 20px 8px;
  border-bottom: 1px solid var(--border-subtle, #e5e5e5);
}
.cut-wizard-header h2 {
  margin: 0;
  font-size: 1.15em;
}
.cut-wizard-progress {
  color: var(--text-muted, #777);
  font-size: 0.85em;
  margin-top: 2px;
}
.cut-wizard-close {
  background: none;
  border: none;
  font-size: 1.6em;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted, #777);
  padding: 0 4px;
}
.cut-wizard-body {
  padding: 12px 20px;
  overflow: auto;
  line-height: 1.45;
}
.cut-wizard-body h3 {
  margin: 4px 0 10px;
  font-size: 1.05em;
}
.cut-wizard-body p {
  margin: 8px 0;
}
.cut-wizard-body ol,
.cut-wizard-body ul {
  padding-left: 22px;
  margin: 8px 0;
}
.cut-wizard-body li {
  margin: 6px 0;
}
.cut-wizard-body code {
  background: var(--input-bg-color, #f0f0f0);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.95em;
}
.cut-wizard-path {
  word-break: break-all;
}
.cut-wizard-footer {
  display: flex;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border-subtle, #e5e5e5);
}
.cut-wizard-spacer {
  flex: 1;
}
.cut-wizard-footer button,
.cut-wizard-actions button,
.cut-wizard-button {
  background: var(--button-bg, #d7d7d7);
  color: var(--text-color, #333);
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  display: inline-block;
}
.cut-wizard-footer button:hover,
.cut-wizard-actions button:hover,
.cut-wizard-button:hover {
  background: var(--button-hover-bg, #e6e6e6);
}
.cut-wizard-footer button:disabled {
  opacity: 0.5;
  cursor: default;
}
.cut-wizard-primary {
  background: var(--button-emphasized-bg, #6b9bb3) !important;
  color: #fff !important;
}
.cut-wizard-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 10px;
}
.cut-wizard-options label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.85em;
  color: var(--text-muted, #777);
}
.cut-wizard-options select {
  font-size: 14px;
  padding: 4px 6px;
  background: var(--input-bg-color, #f0f0f0);
  color: var(--text-color, #333);
  border: 1px solid var(--border-color, #bababa);
  border-radius: 4px;
}
.cut-wizard-table-wrap {
  overflow-x: auto;
  margin: 8px 0;
}
.cut-wizard-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95em;
}
.cut-wizard-table th,
.cut-wizard-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle, #e5e5e5);
  vertical-align: top;
}
.cut-wizard-table th {
  color: var(--text-muted, #777);
  font-weight: 600;
}
.cut-wizard-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--border-color, #bababa);
  vertical-align: -2px;
  margin-right: 6px;
}
.cut-wizard-muted {
  color: var(--text-muted, #777);
}
.cut-wizard-bad {
  color: #c0392b;
}
.cut-wizard-warnings {
  margin: 10px 0 0;
  padding-left: 22px;
}
.cut-wizard-warn {
  color: #b9770e;
}
.cut-wizard-info {
  color: var(--text-muted, #777);
}
.cut-wizard-error {
  background: rgba(192, 57, 43, 0.12);
  border: 1px solid rgba(192, 57, 43, 0.4);
  color: #c0392b;
  padding: 8px 12px;
  border-radius: 4px;
  margin: 0 0 10px;
}
.cut-wizard-note {
  color: var(--text-muted, #777);
  font-size: 0.9em;
}
.cut-wizard-empty {
  padding: 16px 0;
}
.cut-wizard-files {
  list-style: none;
  padding-left: 0;
}
.cut-wizard-actions {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}

/* Technique panel + layer tag */
.technique-hint {
  margin: 2px 10px 8px;
  font-size: 0.8em;
  color: var(--text-muted, #777);
}
.layer-technique {
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 0.7em;
  line-height: 1.4;
  white-space: nowrap;
  background: var(--accent-color, #6c9bbf);
  color: #fff;
}

/* Colorize panel: over the colour limit */
.colorizer-too-many {
  padding: 8px 10px;
  font-size: 0.9em;
}
.colorizer-too-many p {
  margin: 0 0 8px;
}
.colorizer-swatch-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  max-height: 260px;
  overflow-y: auto;
}
.colorizer-swatch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85em;
  white-space: nowrap;
}
.colorizer-swatch i {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--border-color, #bbb);
}
.colorizer-swatch small {
  color: var(--text-muted, #777);
}
.colorizer-reduce-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 8px;
}
.colorizer-reduce-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.colorizer-reduce-row input[type="number"] {
  width: 56px;
}
.colorizer-muted {
  color: var(--text-muted, #777);
  margin: 4px 0 6px;
}
.colorizer-cluster-list {
  max-height: 240px;
  overflow-y: auto;
}
.colorizer-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding: 3px 0;
  border-bottom: 1px dotted var(--border-color, #ddd);
}
.colorizer-arrow {
  color: var(--text-muted, #999);
}
.colorizer-keep code {
  font-weight: bold;
}
.colorizer-gone {
  opacity: 0.55;
}
.colorizer-all-colors {
  margin-top: 8px;
}
.colorizer-all-colors summary {
  cursor: pointer;
  color: var(--text-muted, #777);
  font-size: 0.85em;
}
.colorizer-swatch[data-hex] {
  cursor: pointer;
  border-radius: 4px;
  padding: 1px 3px;
}
.colorizer-swatch[data-hex]:hover {
  background: var(--input-bg-color, #f0f0f0);
}
.colorizer-pinned {
  outline: 1px solid var(--accent-color, #6c9bbf);
  opacity: 1 !important;
}
.colorizer-pin {
  font-size: 0.85em;
  font-weight: normal;
}
.colorizer-pinned-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 0 0 6px;
}
.colorizer-pinned-row:empty {
  display: none;
}

/* ---- CHAT mode: an immersive view. Only the garment, floating on a soft sky, and the conversation.
   body.dt-chat-mode is set by TemplateStudio.showChat; every other panel of the studio is hidden. ---- */
body.dt-chat-mode {
  --chat-w: min(520px, 42vw);
  --chat-right: max(24px, 5vw);
  --chat-font: 17px;
  --chat-ink: #1d2733;
  --chat-muted: rgba(29, 39, 51, 0.55);
  --chat-bubble: rgba(255, 255, 255, 0.82);
  --chat-bubble-border: rgba(255, 255, 255, 0.6);
  --chat-user: rgba(255, 255, 255, 0.45);
  --chat-pill-dark: #1c1f24;
  --chat-shadow: 0 1px 2px rgba(20, 40, 70, 0.06), 0 6px 24px rgba(20, 40, 70, 0.07);
  --chat-sky:
    radial-gradient(120% 80% at 18% 108%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0) 55%),
    radial-gradient(90% 70% at 80% 20%, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0) 60%),
    radial-gradient(70% 60% at 30% 25%, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, #5f8fc4 0%, #8fb2d8 38%, #c6d6e8 72%, #e9eef4 100%);
}
[data-theme="dark"] body.dt-chat-mode {
  --chat-ink: #e8edf3;
  --chat-muted: rgba(232, 237, 243, 0.55);
  --chat-bubble: rgba(40, 48, 60, 0.78);
  --chat-bubble-border: rgba(255, 255, 255, 0.08);
  --chat-user: rgba(255, 255, 255, 0.12);
  --chat-pill-dark: #f2f4f7;
  --chat-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
  --chat-sky:
    radial-gradient(120% 80% at 18% 108%, rgba(120, 150, 190, 0.35) 0%, rgba(0, 0, 0, 0) 55%),
    radial-gradient(70% 60% at 30% 25%, rgba(90, 120, 170, 0.25) 0%, rgba(0, 0, 0, 0) 70%),
    linear-gradient(180deg, #0f1a2a 0%, #1b2b42 45%, #2a3b52 100%);
}

/* nothing of the studio but the garment */
body.dt-chat-mode #dt_topbar,
body.dt-chat-mode #dt_tools,
body.dt-chat-mode #dt_properties_panel,
body.dt-chat-mode #edit-buttons,
body.dt-chat-mode #dt_navigation_menu,
body.dt-chat-mode #camera-button-array,
body.dt-chat-mode #dt_divide,
body.dt-chat-mode #save-to-chat,
body.dt-chat-mode .code-editor { display: none !important; }
body.dt-chat-mode .dt-main { background: var(--chat-sky); }
body.dt-chat-mode .dt-left-container { position: static; width: 100%; height: 100%; }
body.dt-chat-mode .dt-view { position: static; background: transparent; }
/* the garment floats in the space left of the conversation, no frame, no background */
body.dt-chat-mode #dt_3d {
  position: fixed !important;
  left: 0; top: 0; bottom: 0;
  width: calc(100vw - var(--chat-w) - var(--chat-right)) !important;
  height: 100vh !important;
  background: transparent !important;
  z-index: 1;
}
body.dt-chat-mode #dt_3d canvas { background: transparent !important; }

.dt-chat {
  display: none;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0;
  right: var(--chat-right, 24px);
  width: var(--chat-w, 480px);
  z-index: 2;
  color: var(--chat-ink, var(--text-color));
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: var(--chat-font, 17px);
  line-height: 1.45;
}
.dt-chat[hidden] { display: none !important; }

/* Chat | Studio */
.dt-chat-head { display: flex; justify-content: center; padding: 18px 0 6px; flex: none; }
.dt-chat-switch {
  display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px;
  background: var(--chat-user); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--chat-shadow);
}
.dt-chat-switch button {
  border: 0; background: transparent; color: var(--chat-muted); cursor: pointer;
  font: 500 0.82em/1 inherit; font-family: inherit; padding: 8px 16px; border-radius: 999px;
}
.dt-chat-switch button.on { background: var(--chat-pill-dark); color: var(--chat-bubble-solid, #fff); }
[data-theme="dark"] .dt-chat-switch button.on { color: #111; }
.dt-chat-switch button:not(.on):hover { color: var(--chat-ink); }

/* the conversation: bubbles on the sky, fading out at the top */
.dt-chat-thread {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
  padding: 24px 6px 12px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 56px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 56px);
  scrollbar-width: none;
}
.dt-chat-thread::-webkit-scrollbar { display: none; }
.dt-chat-msg { display: flex; flex-direction: column; gap: 8px; max-width: 86%; }
.dt-chat-msg.user { align-self: flex-end; align-items: flex-end; }
.dt-chat-msg.assistant { align-self: flex-start; align-items: flex-start; }
.dt-chat-text { padding: 11px 16px; border-radius: 18px; word-wrap: break-word; overflow-wrap: anywhere; }
.dt-chat-text:empty { display: none; }
.dt-chat-msg.assistant .dt-chat-text {
  background: var(--chat-bubble); border: 1px solid var(--chat-bubble-border);
  backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: var(--chat-shadow);
}
.dt-chat-msg.user .dt-chat-text {
  background: var(--chat-user);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  padding: 9px 15px;
}
.dt-chat-text p { margin: 0 0 8px; }
.dt-chat-text p:last-child { margin-bottom: 0; }
.dt-chat-text ul { margin: 4px 0 8px 20px; padding: 0; }
.dt-chat-text a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.dt-chat-text code { font-size: 0.9em; background: rgba(0, 0, 0, 0.06); padding: 1px 5px; border-radius: 5px; }

/* what the designer did: one quiet pill per step (the separate tool chips are kept only as data) */
.dt-chat-chips { display: none; }
.dt-chat-activity {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px; font-size: 0.86em; font-weight: 500;
  background: var(--chat-user); color: var(--chat-ink);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.dt-chat-activity:empty { display: none; }
.dt-chat-activity.done { background: var(--chat-pill-dark); color: #fff; }
[data-theme="dark"] .dt-chat-activity.done { color: #111; }
.dt-chat-activity.failed { background: rgba(201, 70, 61, 0.14); color: #a3352d; }
.dt-chat-activity .icon { width: 14px; height: 14px; flex: none; }
.dt-chat-activity.running .icon {
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: dt-chat-spin 0.8s linear infinite; opacity: 0.6;
}
@keyframes dt-chat-spin { to { transform: rotate(360deg); } }

.dt-chat-note { align-self: center; color: var(--chat-muted); font-size: 0.82em; text-align: center; padding: 2px 10px; }

/* pictures: no names, no frames */
.dt-chat-pictures { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.dt-chat-pictures img { max-width: 200px; max-height: 200px; border-radius: 16px; object-fit: cover; box-shadow: var(--chat-shadow); }

/* the bottom: suggestions, pictures waiting, the message box */
.dt-chat-dock { flex: none; padding: 6px 0 14px; display: flex; flex-direction: column; gap: 8px; }
.dt-chat-status { min-height: 1.2em; padding: 0 8px; color: var(--chat-muted); font-size: 0.8em; }
.dt-chat-status:empty { min-height: 0; }
.dt-chat-replies { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.dt-chat-reply {
  border: 0; cursor: pointer; font: inherit; font-size: 0.88em; color: var(--chat-ink);
  padding: 8px 14px; border-radius: 999px; background: var(--chat-user);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: background 0.15s;
}
.dt-chat-reply:hover { background: var(--chat-bubble); }
.dt-chat-attachments { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 6px; }
.dt-chat-attachments:empty { display: none; }
.dt-chat-attachment { position: relative; }
.dt-chat-attachment img { width: 56px; height: 56px; object-fit: cover; border-radius: 14px; box-shadow: var(--chat-shadow); display: block; }
.dt-chat-attachment span { display: none; }
.dt-chat-attachment button {
  position: absolute; right: -6px; top: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--chat-pill-dark); color: #fff; font-size: 13px; line-height: 20px; padding: 0;
}
.dt-chat-attachment.uploading img { opacity: 0.5; }
.dt-chat-composer {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 8px 8px 14px; border-radius: 26px;
  background: var(--chat-bubble); border: 1px solid var(--chat-bubble-border);
  backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: var(--chat-shadow);
}
.dt-chat-composer textarea {
  flex: 1; resize: none; border: 0; outline: none; background: transparent; color: var(--chat-ink);
  font: inherit; line-height: 1.4; padding: 7px 0; max-height: 9em; min-height: 1.4em; box-sizing: border-box; align-self: center;
}
.dt-chat-composer textarea::placeholder { color: var(--chat-muted); }
.dt-chat-icon {
  flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--chat-muted); padding: 0;
}
.dt-chat-icon:hover { color: var(--chat-ink); background: rgba(0, 0, 0, 0.05); }
.dt-chat-icon svg { width: 20px; height: 20px; }
.dt-chat-send { background: var(--chat-pill-dark); color: #fff; }
[data-theme="dark"] .dt-chat-send { color: #111; }
.dt-chat-send:hover { background: var(--chat-pill-dark); color: #fff; opacity: 0.88; }
.dt-chat-send:disabled { opacity: 0.25; cursor: default; }
.dt-chat-stop[hidden], .dt-chat-send[hidden] { display: none; }
.dt-chat-foot { text-align: center; color: var(--chat-muted); font-size: 0.7em; }
.dt-chat-dropping .dt-chat-composer { outline: 2px dashed var(--chat-ink); outline-offset: 4px; }
/* controls under a message (StudioChat.drawControls): fine-tuning without a model turn */
.dt-chat-controls {
  display: flex; flex-direction: column; gap: 4px; align-self: stretch;
  padding: 8px 16px; border-radius: 18px; min-width: min(340px, 100%);
  background: var(--chat-bubble); border: 1px solid var(--chat-bubble-border);
  backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: var(--chat-shadow);
}
.dt-chat-control {
  display: grid; grid-template-columns: 9.5em 1fr 4.6em; align-items: center; gap: 12px;
  font-size: 0.84em; min-height: 32px; cursor: default;
}
.dt-chat-control .label { color: var(--chat-muted); min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
/* the thing it works on over what it changes */
.dt-chat-control .label b, .dt-chat-control .label span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dt-chat-control .label b { color: var(--chat-ink); font-weight: 600; }
.dt-chat-control .label b + span { font-size: 0.9em; }
.dt-chat-control .value { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dt-chat-control input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 0; background: transparent; cursor: pointer;
}
.dt-chat-control input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(to right, var(--chat-ink) var(--fill, 50%), rgba(127, 140, 155, 0.28) var(--fill, 50%));
}
.dt-chat-control input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(127, 140, 155, 0.28); }
.dt-chat-control input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--chat-ink); }
.dt-chat-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%;
  background: #fff; border: 0; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 0 0 0.5px rgba(0, 0, 0, 0.12);
}
.dt-chat-control input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.dt-chat-control input[type="range"]:focus-visible { outline: none; }
.dt-chat-control input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px rgba(80, 140, 220, 0.45); }
.dt-chat-control.swatches { grid-template-columns: 6.6em 1fr; grid-template-areas: "label value" "sw sw"; row-gap: 6px; padding: 4px 0; }
.dt-chat-control.swatches .label { grid-area: label; }
.dt-chat-control.swatches .value { grid-area: value; }
.dt-chat-swatches { grid-area: sw; display: flex; flex-wrap: wrap; gap: 7px; }
.dt-chat-swatch {
  width: 26px; height: 26px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); transition: transform 0.12s;
}
.dt-chat-swatch:hover { transform: scale(1.12); }
.dt-chat-swatch.on { box-shadow: 0 0 0 2px var(--chat-bubble-solid, #fff), 0 0 0 4px var(--chat-ink); }
/* after the next message: what the controls were left at, one quiet line */
.dt-chat-controls.spent {
  background: none; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
  flex-direction: row; flex-wrap: wrap; gap: 4px 14px; padding: 0 6px; min-width: 0;
}
.dt-chat-controls.spent .dt-chat-control { display: block; min-height: 0; font-size: 0.78em; }

/* a narrow window: the garment on top, the conversation below it */
@media (max-width: 820px) {
  body.dt-chat-mode { --chat-w: auto; --chat-right: 0px; --chat-font: 16px; }
  body.dt-chat-mode #dt_3d { top: 56px; width: 100vw !important; height: calc(42vh - 56px) !important; bottom: auto; }
  body.dt-chat-mode .dt-chat { top: 42vh; left: 12px; right: 12px; width: auto; }
  body.dt-chat-mode .dt-chat-head { position: fixed; top: 0; left: 0; right: 0; }
}

/* the sketch bar (StudioChat.sketchBar): Pen / Box / Circle / Rotate / Done for drawing on the 3D model */
.dt-chat-sketchbar { color: var(--chat-ink); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px; margin-bottom: 6px; border-radius: 14px; background: var(--chat-bubble); border: 1px solid var(--chat-bubble-border); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); box-shadow: var(--chat-shadow); }
.dt-chat-sketchbar[hidden] { display: none; }
.dt-chat-sketchbar .label { font-size: 12px; color: var(--chat-ink); opacity: 0.65; margin-right: 4px; }
.dt-chat-sketchbar button { border: 1px solid var(--chat-bubble-border); background: transparent; color: var(--chat-ink); border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer; }
.dt-chat-sketchbar button.on { background: var(--chat-pill-dark); color: var(--chat-bubble-solid, #fff); border-color: var(--chat-pill-dark); }
.dt-chat-sketchbar button.done { margin-left: auto; }

/* the pen's colour and width (PenOptions): the studio's properties panel and the chat's sketch bar */
.pen-options { display: flex; flex-direction: column; gap: 8px; }
.pen-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.pen-swatch { width: 24px; height: 24px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.25); cursor: pointer; padding: 0; }
.pen-swatch.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1d1f24; }
.pen-width { display: flex; align-items: center; gap: 8px; font-size: 12px; color: inherit; opacity: 0.8; }
.pen-width input[type=range] { flex: 1; min-width: 80px; }
.pen-width span { min-width: 48px; text-align: right; font-variant-numeric: tabular-nums; }
.pen-panel { padding: 10px; }
.pen-panel h3 { margin: 0 0 4px; }
.pen-panel .pen-desc { font-size: 12px; color: #667; margin: 0 0 10px; }
.dt-chat-sketchbar .pen-options { flex-basis: 100%; flex-direction: row; align-items: center; gap: 12px; }
.dt-chat-sketchbar .pen-swatch { width: 20px; height: 20px; }
.dt-chat-sketchbar .pen-width { flex: 1; }

/* phones and touch-only tablets stay in the chat: the studio is a desktop tool (mouse, panels) */
@media (max-width: 820px), (hover: none) and (pointer: coarse) {
    body.dt-chat-mode .dt-chat-switch { display: none; }
}

/* the + menu (StudioChat ADD_KINDS): what can be added, each saying what it is for */
.dt-chat-addmenu { display: flex; flex-direction: column; gap: 2px; padding: 6px; margin: 0 6px 6px; border-radius: 18px; background: var(--chat-bubble); border: 1px solid var(--chat-bubble-border); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); box-shadow: var(--chat-shadow, 0 4px 20px rgba(0,0,0,0.12)); max-width: 340px; }
.dt-chat-addmenu[hidden] { display: none; }
.dt-chat-addmenu button { display: flex; align-items: center; gap: 12px; border: 0; background: transparent; color: var(--chat-ink, #1d1f24); text-align: left; padding: 9px 10px; border-radius: 12px; cursor: pointer; font: inherit; }
.dt-chat-addmenu button:hover, .dt-chat-addmenu button:focus-visible { background: color-mix(in srgb, var(--chat-ink) 9%, transparent); outline: none; }
.dt-chat-addmenu .ico { width: 22px; height: 22px; flex: none; opacity: 0.8; }
.dt-chat-addmenu .ico svg { width: 100%; height: 100%; }
.dt-chat-addmenu .txt { display: flex; flex-direction: column; line-height: 1.25; }
.dt-chat-addmenu b { font-weight: 600; font-size: 14px; }
.dt-chat-addmenu small { font-size: 12px; opacity: 0.65; }
@media (max-width: 820px) { .dt-chat-addmenu { max-width: none; } .dt-chat-addmenu button { padding: 12px; } }

/* a waiting font / list / logo file: a tile with its icon and name */
.dt-chat-attachment .tile { display: flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 14px; background: var(--chat-bubble); border: 1px solid var(--chat-bubble-border); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); box-shadow: var(--chat-shadow); color: var(--chat-ink, #1d1f24); }
.dt-chat-attachment .tile svg { width: 26px; height: 26px; }
.dt-chat-attachment.kind-font span, .dt-chat-attachment.kind-roster span { display: block; position: absolute; left: 0; right: 0; bottom: -16px; font-size: 10px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--chat-ink, #333); }
.dt-chat-attachment.kind-font, .dt-chat-attachment.kind-roster { margin-bottom: 14px; }
.dt-chat-attachment.uploading .tile { opacity: 0.5; }
.dt-chat-filetag { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--chat-bubble); border: 1px solid var(--chat-bubble-border); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); color: var(--chat-ink); box-shadow: var(--chat-shadow); font-size: 13px; }
.dt-chat-filetag svg { width: 16px; height: 16px; }

/* the Players bar (preview_players): step the design through the names list */
.dt-chat-playerbar { color: var(--chat-ink); display: flex; align-items: center; gap: 6px; padding: 6px 8px; margin-bottom: 6px; border-radius: 14px; background: var(--chat-bubble); border: 1px solid var(--chat-bubble-border); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); box-shadow: var(--chat-shadow); }
.dt-chat-playerbar[hidden] { display: none; }
.dt-chat-playerbar .label { font-size: 12px; color: var(--chat-ink); opacity: 0.65; margin-right: 4px; }
.dt-chat-playerbar button { border: 1px solid var(--chat-bubble-border); background: transparent; color: var(--chat-ink); border-radius: 999px; padding: 4px 12px; font-size: 14px; cursor: pointer; }
.dt-chat-playerbar select { flex: 1; min-width: 0; border: 1px solid var(--chat-bubble-border); border-radius: 10px; padding: 4px 8px; font: inherit; font-size: 13px; background: transparent; color: var(--chat-ink); }
.dt-chat-playerbar select option { color: #111; }
.dt-chat-playerbar .done { margin-left: auto; }

/* a card the server asks for (StudioChat.drawCard): sign in to keep going, or the plans */
.dt-chat-card { margin-top: 10px; padding: 12px 14px; border-radius: 16px; background: var(--chat-bubble); border: 1px solid var(--chat-bubble-border); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); color: var(--chat-ink); }
.dt-chat-card.upgrade { padding: 0; background: transparent; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
.dt-chat-card-title { font-weight: 600; }
.dt-chat-card-sub { font-size: 13px; opacity: 0.7; margin: 2px 0 10px; }
.dt-chat-card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dt-chat-card-btn { border: 1px solid var(--chat-bubble-border); background: var(--chat-bubble-solid, #fff); color: #1f1f1f; border-radius: 999px; padding: 8px 16px; font: inherit; font-size: 14px; cursor: pointer; }
.dt-chat-card-btn.apple { background: #000; color: #fff; border-color: #000; }
/* no WebGL: pictures of the design drawn by the server (StudioChat.showPictures) */
.dt-chat-pictures { display: flex; gap: 8px; margin-top: 10px; }
.dt-chat-pictures a { flex: 1 1 0; min-width: 0; }
.dt-chat-pictures img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 12px; background: rgba(255,255,255,.45); display: block; }
.dt-no-gl-view { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 2%; padding: 4%; pointer-events: none; z-index: 1; }
.dt-no-gl-view img { flex: 1 1 0; min-width: 0; max-height: 100%; object-fit: contain; }
/* designs that already exist (find_existing_designs) */
.dt-chat-existing { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 10px; }
.dt-chat-existing-item { display: flex; flex-direction: column; gap: 6px; }
.dt-chat-existing-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: rgba(255,255,255,.5); }
.dt-chat-existing-title { font-size: 13px; line-height: 1.25; }
.dt-chat-existing-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.dt-chat-existing-actions .dt-chat-card-btn { padding: 5px 12px; font-size: 13px; text-decoration: none; }
.dt-chat-card-link { border: 0; background: transparent; color: var(--chat-ink); text-decoration: underline; font: inherit; font-size: 13px; cursor: pointer; padding: 0; opacity: 0.8; }

/* teegpt.shop's front door: sign in / my account at the top */
.dt-chat-head { position: relative; }
.dt-chat-account { position: static; font-size: 13px; color: var(--chat-ink); text-decoration: none; padding: 6px 12px; border-radius: 999px; background: var(--chat-bubble); border: 1px solid var(--chat-bubble-border); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.dt-chat-account:hover { opacity: 0.85; }
/* a signed-in customer: their picture (or initial) in a circle */
.dt-chat-account.avatar { width: 40px; height: 40px; padding: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 17px; font-weight: 600; box-shadow: var(--chat-shadow, 0 2px 10px rgba(0,0,0,0.12)); }
.dt-chat-account.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* a phone: no top bar; the garment from the very top, fixed, with the sign-in / avatar floating over it */
@media (max-width: 820px) {
  body.dt-chat-mode .dt-chat-head { position: fixed; top: 0; right: 0; left: auto; width: 0; height: 0; padding: 0; overflow: visible; }
  body.dt-chat-mode .dt-chat-corner-tools { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 10px); right: 12px; z-index: 7; }
  body.dt-chat-mode #dt_3d { position: fixed; top: 0; height: 42vh !important; }
}
/* the header sits above the thread (which scrolls under it): its buttons take clicks, the empty rest does not */
body.dt-chat-mode .dt-chat-head { z-index: 6; pointer-events: none; }
body.dt-chat-mode .dt-chat-head > * { pointer-events: auto; }

/* teegpt.shop's start page (views/teegptStart.hbs): the sky and the name until the garment and the chat are there */
.dt-chat-cover { display: none; }
body.dt-chat-starting .dt-chat-cover {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  position: fixed; inset: 0; z-index: 50; background: var(--chat-sky); color: var(--chat-ink);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
.dt-chat-cover { transition: opacity .35s ease; }
.dt-chat-cover-mark { display: flex; align-items: center; gap: 10px; font-size: 28px; font-weight: 700; letter-spacing: -.01em; }
.dt-chat-cover-mark .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--chat-ink); animation: dt-chat-cover-pulse 1.4s ease-in-out infinite; }
.dt-chat-cover-line { font-size: 15px; color: var(--chat-muted); }
.dt-chat-cover-intro { margin: 0; max-width: 34em; padding: 0 24px; text-align: center; font-size: 18px; line-height: 1.4; }
@keyframes dt-chat-cover-pulse { 50% { transform: scale(.6); opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .dt-chat-cover-mark .dot { animation: none; } }

/* the "Already out there" card: each design flips to its back (hover with a mouse, ⇄ anywhere) */
.dt-chat-flip { position: relative; width: 100%; aspect-ratio: 1; perspective: 900px; }
.dt-chat-flip-inner { position: absolute; inset: 0; transition: transform 0.5s ease; transform-style: preserve-3d; }
.dt-chat-flip img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 12px; background: rgba(255,255,255,.5); backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.dt-chat-flip img.back { transform: rotateY(180deg); }
.dt-chat-flip.flipped .dt-chat-flip-inner { transform: rotateY(180deg); }
@media (hover: hover) { .dt-chat-flip:not(.no-back):hover .dt-chat-flip-inner { transform: rotateY(180deg); } .dt-chat-flip.flipped:hover .dt-chat-flip-inner { transform: none; } }
.dt-chat-flip-btn { position: absolute; right: 1px; top: 1px; width: 20px; height: 20px; border: 0; background: none; padding: 0; color: #1d1f24; font-size: 15px; font-weight: 700; line-height: 20px; text-align: center; cursor: pointer; text-shadow: 0 0 3px #fff, 0 0 2px #fff; transition: transform .12s ease; }
.dt-chat-flip-btn:hover { transform: scale(1.12); }
.dt-chat-flip.no-back .dt-chat-flip-btn { display: none; }

/* Remix (lower left) and View in shop (lower right) as icons on each design's picture; they stay put while it flips */
.dt-chat-corner { position: absolute; bottom: 1px; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 2; transition: transform .12s ease; }
.dt-chat-corner.left { left: 1px; }
.dt-chat-corner.right { right: 1px; }
.dt-chat-corner:hover { transform: scale(1.08); }
.dt-chat-corner img { width: 22px; height: 22px; object-fit: contain; position: static; border-radius: 0; background: none; backface-visibility: visible; transform: none; filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.35)); }
.dt-chat-flip-btn { z-index: 2; }

/* teegpt.shop's links under the chat (Observer, Plans, About, Terms, Privacy), as on the old chat app */
.dt-chat-legal { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 14px; padding: 4px 0 2px; font-size: 0.68em; color: var(--chat-muted); opacity: .8; }
.dt-chat-legal a { color: inherit; text-decoration: none; }
.dt-chat-legal a:hover, .dt-chat-legal a:focus-visible { color: var(--chat-ink); text-decoration: underline; }

/* the chat's top corner (teegpt.shop): light / dark, then Sign in or the avatar */
.dt-chat-corner-tools { position: absolute; right: 12px; top: 14px; display: flex; align-items: center; gap: 8px; }
.dt-chat-theme { width: 34px; height: 34px; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--chat-ink); background: var(--chat-bubble); border: 1px solid var(--chat-bubble-border); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.dt-chat-theme:hover { opacity: 0.85; }

/* teegpt.shop's start screen (StudioChat.setLanding, body.dt-chat-landing until the first message): the heading,
   the message box in the vertical middle of the chat column, what teegpt is under it; no reply buttons yet */
.dt-chat-landing-head, .dt-chat-intro { display: none; }
body.dt-chat-landing .dt-chat-thread { display: none; }
body.dt-chat-landing .dt-chat-dock { margin: auto 0; padding-bottom: 6vh; gap: 12px; }
body.dt-chat-landing .dt-chat-landing-head { display: block; text-align: center; margin-bottom: 10px; }
body.dt-chat-landing .dt-chat-landing-head h1 { margin: 0; font-size: 1.85em; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; color: var(--chat-ink); }
body.dt-chat-landing .dt-chat-replies { display: none; }
body.dt-chat-landing .dt-chat-composer { padding: 12px 10px 12px 18px; border-radius: 30px; }
body.dt-chat-landing .dt-chat-composer textarea { min-height: 3em; font-size: 1.02em; }
body.dt-chat-landing .dt-chat-intro { display: block; margin: 6px auto 0; max-width: 34em; text-align: center; font-size: 0.78em; line-height: 1.6; color: var(--chat-muted); }
@media (max-width: 820px) {
  body.dt-chat-landing .dt-chat-dock { padding-bottom: 2vh; }
  body.dt-chat-landing .dt-chat-landing-head h1 { font-size: 1.45em; }
  body.dt-chat-landing .dt-chat-intro { font-size: 0.74em; }
}

/* the start screen's three ways in (StudioChat.startChoices): Blank canvas · Remix a design · Presets, and the
   row of tiles the last two open; start screen only */
.dt-chat-starts, .dt-chat-startrow { display: none; }
body.dt-chat-landing .dt-chat-starts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
body.dt-chat-landing .dt-chat-starts a { text-decoration: none; display: inline-block; }   /* Remix a design: a link to the Gallery, drawn as the buttons */
body.dt-chat-landing .dt-chat-starts button, body.dt-chat-landing .dt-chat-starts a { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--chat-bubble-border); background: var(--chat-bubble); color: var(--chat-ink); font: inherit; font-size: 0.86em; font-weight: 600; cursor: pointer; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
body.dt-chat-landing .dt-chat-starts button[hidden], body.dt-chat-landing .dt-chat-starts a[hidden] { display: none; }
body.dt-chat-landing .dt-chat-starts button:hover, body.dt-chat-landing .dt-chat-starts a:hover { border-color: var(--chat-ink); }
body.dt-chat-landing .dt-chat-starts button.on { background: var(--chat-pill-dark); border-color: var(--chat-pill-dark); color: var(--chat-bubble-solid, #fff); }
[data-theme="dark"] body.dt-chat-landing .dt-chat-starts button.on { color: #111; }
body.dt-chat-landing .dt-chat-startrow:not([hidden]) { display: flex; justify-content: safe center; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity; }
.dt-chat-startrow > * { flex: 0 0 112px; min-width: 0; scroll-snap-align: start; }
.dt-chat-preset span { overflow-wrap: anywhere; }
.dt-chat-preset { display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none; color: var(--chat-ink); font: inherit; font-size: 13px; line-height: 1.25; text-align: left; cursor: pointer; }
.dt-chat-preset img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; background: rgba(255,255,255,.5); transition: transform .12s ease; }
.dt-chat-preset:hover img, .dt-chat-preset:focus-visible img { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,.14); }

/* teegpt.shop's intro film (public/teegpt/intro.js): a window of 80% of the screen on a computer, the whole
   screen on a phone; above the start cover (50) and the design lightbox (60) */
.tg-intro-link { display: none; }
.tg-intro-ready .tg-intro-link { display: inline; }
.tg-intro { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; background: rgba(8, 12, 20, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); font-family: 'Inter', system-ui, sans-serif; }
/* desktop: the window is the 16:9 film plus its 60px bar, as large as fits in 80% of the screen, no black sides */
.tg-intro-box { position: relative; width: min(80vw, calc((80vh - 60px) * 16 / 9)); display: flex; flex-direction: column; background: #000; border-radius: 16px; overflow: hidden; box-shadow: 0 24px 80px rgba(0, 0, 0, .45); }
.tg-intro-stage { position: relative; container-type: inline-size; }
.tg-intro-box video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: contain; background: #000; }
.tg-intro.phone { background: #000; }
.tg-intro.phone .tg-intro-stage { flex: 1; min-height: 0; }
.tg-intro.phone .tg-intro-box video { height: 100%; aspect-ratio: auto; }
.tg-intro.phone .tg-intro-box { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; box-shadow: none; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); box-sizing: border-box; }
.tg-intro-x { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 12px; z-index: 2; width: 38px; height: 38px; padding: 0; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; font-size: 24px; line-height: 38px; cursor: pointer; }
.tg-intro-sound { position: absolute; top: calc(16px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 2; padding: 13px 24px; border-radius: 999px; border: 0; background: #fff; color: #111; font: inherit; font-size: 15px; font-weight: 700; letter-spacing: .04em; white-space: nowrap; cursor: pointer; box-shadow: 0 6px 24px rgba(0, 0, 0, .35); }
.tg-intro-sound:hover { transform: translateX(-50%) scale(1.04); }
.tg-intro-sound[hidden] { display: none; }
.tg-intro-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; background: #0d1117; color: #e8edf3; font-size: 14px; }
.tg-intro-off { display: flex; align-items: center; gap: 8px; cursor: pointer; opacity: .85; }
.tg-intro-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.tg-intro-acts > * { padding: 9px 16px; border-radius: 999px; border: 1px solid #fff; background: #fff; color: #111; font: inherit; font-weight: 600; cursor: pointer; }
/* the bar's "Tell me more" is there while part 1 plays; at the end it is with the end's buttons */
.tg-intro[data-part="2"] .tg-intro-acts .tg-intro-more, .tg-intro.no-part2 .tg-intro-acts .tg-intro-more, .tg-intro.ended .tg-intro-acts .tg-intro-more { display: none; }
/* a part's end: its buttons large over the film's end card, in the room the card leaves under the wordmark (computer:
   the right half, under "teegpt.shop", from 59% down; phone: centred from 30% down, the shirt below), rows growing
   downwards, sized to the film (cqw: the stage's width) */
.tg-intro-end { position: absolute; left: 50%; right: 4%; top: 59%; display: none; flex-wrap: wrap; justify-content: center; gap: .6em; font-size: 20px; font-size: clamp(15px, 1.75cqw, 26px); pointer-events: none; }
.tg-intro.phone .tg-intro-end { left: 0; right: 0; top: 30%; padding: 0 4%; font-size: clamp(15px, 4.4cqw, 22px); }
.tg-intro.ended .tg-intro-end { display: flex; animation: tg-intro-end .35s ease both; }
@keyframes tg-intro-end { from { opacity: 0; } }
.tg-intro-end > * { display: none; pointer-events: auto; padding: .6em 1.25em; border-radius: 999px; border: 2px solid rgba(255, 255, 255, .4); background: rgba(13, 17, 23, .55); color: #fff; font: inherit; font-weight: 700; line-height: 1.2; text-decoration: none; white-space: nowrap; cursor: pointer; }
.tg-intro-end > *:hover { border-color: #fff; }
.tg-intro-end .tg-intro-go { background: #fff; border-color: #fff; color: #111; }
.tg-intro[data-part="1"] .tg-intro-end .tg-intro-more, .tg-intro[data-part="1"] .tg-intro-end .tg-intro-go,
.tg-intro[data-part="2"] .tg-intro-end .tg-intro-plans, .tg-intro[data-part="2"] .tg-intro-end .tg-intro-tut, .tg-intro[data-part="2"] .tg-intro-end .tg-intro-guide, .tg-intro[data-part="2"] .tg-intro-end .tg-intro-go { display: inline-block; }
.tg-intro.no-part2 .tg-intro-end .tg-intro-more { display: none; }

/* teegpt.shop's 3D side while the shirt is loading (views/teegptStart.hbs loadingView) */
.dt-3d-loading { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; pointer-events: none; transition: opacity .5s ease; color: var(--chat-ink, #1d2733); font-family: 'Inter', system-ui, sans-serif; }
.dt-3d-loading.done { opacity: 0; }
.dt-3d-loading-spin { width: 44px; height: 44px; border-radius: 50%; border: 3px solid rgba(29, 39, 51, 0.15); border-top-color: var(--chat-pill-dark, #1c1f24); animation: dt-3d-spin 0.9s linear infinite; }
[data-theme="dark"] .dt-3d-loading-spin { border-color: rgba(255, 255, 255, 0.18); border-top-color: #f2f4f7; }
.dt-3d-loading-text { font-size: 14px; opacity: 0.75; text-align: center; padding: 0 20px; }
.dt-3d-loading-text:empty { display: none; }
.dt-3d-loading.failed { pointer-events: auto; }
.dt-3d-loading.failed .dt-3d-loading-spin { display: none; }
.dt-3d-loading.failed a { color: inherit; font-weight: 600; }
@keyframes dt-3d-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .dt-3d-loading-spin { animation-duration: 2.4s; } }

/* a design from the "Already out there" card, large (StudioChat.previewDesign) */
.dt-chat-flip { cursor: zoom-in; }
.dt-chat-lightbox { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(15, 22, 34, 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); font-family: 'Inter', system-ui, sans-serif; color: var(--chat-ink, #1d2733); }
.dt-chat-lightbox-card { position: relative; width: min(760px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; border-radius: 22px; background: var(--chat-bubble-solid, #fff); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); overflow: hidden; }
[data-theme="dark"] .dt-chat-lightbox-card { background: #1f2733; }
.dt-chat-lightbox-pic { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, #eef3f9, #dfe7f1); }
[data-theme="dark"] .dt-chat-lightbox-pic { background: linear-gradient(180deg, #2a3646, #1d2733); }
.dt-chat-lightbox-pic img { width: 100%; max-height: calc(100vh - 150px); aspect-ratio: 1; object-fit: contain; display: block; }
.dt-chat-lightbox-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
.dt-chat-lightbox-views { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(29, 39, 51, 0.08); }
[data-theme="dark"] .dt-chat-lightbox-views { background: rgba(255, 255, 255, 0.1); }
.dt-chat-lightbox-views button { border: 0; background: transparent; color: inherit; font: 500 13px/1 inherit; font-family: inherit; padding: 7px 14px; border-radius: 999px; cursor: pointer; opacity: 0.7; }
.dt-chat-lightbox-views button.on { background: var(--chat-pill-dark, #1c1f24); color: #fff; opacity: 1; }
[data-theme="dark"] .dt-chat-lightbox-views button.on { background: #f2f4f7; color: #111; }
.dt-chat-lightbox-title { flex: 1; min-width: 120px; font-weight: 600; font-size: 15px; }
.dt-chat-lightbox-acts { display: flex; gap: 8px; }
.dt-chat-lightbox-acts .dt-chat-card-btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.dt-chat-lightbox-acts .dt-chat-card-btn img { width: 18px; height: 18px; }
.dt-chat-lightbox-x { position: absolute; top: 10px; right: 10px; z-index: 2; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.85); color: #1d2733; font-size: 22px; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); }
@media (max-width: 600px) { .dt-chat-lightbox { padding: 10px; } .dt-chat-lightbox-title { flex-basis: 100%; order: -1; } }

/* the chat's colour picker (public/js/chat/colourPicker.js, from the teegpt chat app), on the chat's look */
.cp-overlay { --surface: var(--chat-bubble-solid, #fff); --field: #fff; --ink: var(--chat-ink, #1d2733); --muted: rgba(29, 39, 51, 0.6); --line: rgba(29, 39, 51, 0.1); --line-strong: rgba(29, 39, 51, 0.2); --accent: #1c1f24; --accent-dim: #3a3f47; --accent-ink: #fff; --accent-text: #1d2733; --ring: rgba(0, 0, 0, .15); --ring-strong: rgba(0, 0, 0, .3); --checker: #ddd; --radius: 20px; --shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: fixed; inset: 0; z-index: 60; background: rgba(15, 22, 34, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 16px; font-family: 'Inter', system-ui, sans-serif; font-size: 14px; color: var(--ink); }
[data-theme="dark"] .cp-overlay { --surface: #1f2733; --field: rgba(255, 255, 255, 0.06); --ink: #e8edf3; --muted: rgba(232, 237, 243, 0.6); --line: rgba(255, 255, 255, 0.1); --line-strong: rgba(255, 255, 255, 0.2); --accent: #f2f4f7; --accent-dim: #d5d9df; --accent-ink: #111418; --accent-text: #e8edf3; --ring: rgba(255, 255, 255, .15); --ring-strong: rgba(255, 255, 255, .3); --checker: #333; }
.cp-overlay .muted { color: var(--muted); }
.cp-overlay .btn { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); padding: 8px 14px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px; }
.cp-overlay .btn.small { padding: 5px 11px; font-size: 12.5px; }
.cp-overlay .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.cp-overlay .btn:disabled { opacity: .45; cursor: default; }
.cp-sheet { width: min(720px, 100%); max-height: min(88vh, 820px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.cp-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); flex: none; }
.cp-head strong { font-size: 15px; }
.cp-slots { display: flex; gap: 8px; padding: 10px 14px 0; flex-wrap: wrap; align-items: flex-start; flex: none; }
.cp-slot { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--field); color: var(--ink); cursor: pointer; font: inherit; font-size: 12px; text-align: left; flex: none; }
.cp-slot.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.cp-slot.cp-add { border-style: dashed; color: var(--muted); }
.cp-slot span { display: flex; flex-direction: column; line-height: 1.25; }
.cp-slot i, .cp-chip i, .cp-current i, .cp-fam i { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--ring-strong); flex: none; display: inline-block; align-self: center; }
.cp-slot i.cp-none { display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-weight: 700; color: var(--muted); background: repeating-linear-gradient(45deg, transparent 0 4px, var(--ring) 4px 8px); }
.cp-slot em { font-style: normal; color: var(--muted); padding-left: 4px; }
.cp-tabs { display: flex; gap: 4px; padding: 10px 14px 0; flex: none; }
.cp-tabs button { font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--muted); cursor: pointer; }
.cp-tabs button.on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.cp-body { flex: 1; overflow: auto; padding: 10px 14px; min-height: 0; }
.cp-search { width: 100%; box-sizing: border-box; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--field); color: var(--ink); outline: none; font: inherit; }
.cp-search:focus { border-color: var(--accent-dim); }
.cp-fams { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.cp-fam { display: inline-flex; align-items: center; gap: 5px; font: inherit; font-size: 11.5px; padding: 3px 9px 3px 4px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.cp-fam i { width: 14px; height: 14px; }
.cp-fam.on { color: var(--ink); border-color: var(--accent-dim); }
.cp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(26px, 1fr)); gap: 3px; }
.cp-sw { aspect-ratio: 1; border: 0; border-radius: 4px; cursor: pointer; padding: 0; outline: 1px solid var(--ring); }
.cp-sw:hover { transform: scale(1.25); position: relative; z-index: 1; outline-color: var(--ring-strong); }
.cp-sw.on { outline: 2px solid var(--accent); outline-offset: 1px; }
.cp-loading { grid-column: 1 / -1; padding: 20px 0; text-align: center; }
.cp-sources { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cp-src { width: 44px; height: 44px; padding: 2px; border-radius: 8px; border: 1px solid var(--line-strong); background: #fff; cursor: pointer; position: relative; }
.cp-src.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cp-src img { width: 100%; height: 100%; object-fit: contain; }
.cp-dominant { margin-top: 10px; }
.cp-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.cp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-chip { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--field); color: var(--ink); cursor: pointer; }
.cp-canvas-wrap { margin-top: 10px; max-height: 300px; overflow: auto; border-radius: 10px; border: 1px solid var(--line); background: repeating-conic-gradient(var(--checker) 0 25%, transparent 0 50%) 0 0 / 16px 16px; }
.cp-canvas { display: block; cursor: crosshair; }
.cp-zoom { display: flex; gap: 4px; align-items: center; margin-top: 6px; font-size: 12px; }
.cp-sample { margin-top: 6px; font-size: 12.5px; }
.cp-sample .dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -2px; border: 1px solid var(--ring-strong); }
.cp-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); flex: none; }
.cp-current { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
@media (max-width: 600px) { .cp-overlay { padding: 0; } .cp-sheet { max-height: 100vh; height: 100%; border-radius: 0; } }
/* In CHAT mode the picker recolours the shirt live, so the shirt stays in full view: the sheet takes the
   conversation's place on the right (below the shirt in a narrow window), with no dimming or blur over the
   garment, and the garment can still be turned while picking (the overlay lets clicks through; Close,
   Esc or "Use these colours" end it). */
body.dt-chat-mode .cp-overlay { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; pointer-events: none; justify-content: flex-end; align-items: center; padding: 16px var(--chat-right, 24px) 16px 16px; }
body.dt-chat-mode .cp-sheet { pointer-events: auto; width: var(--chat-w, 480px); max-height: calc(100vh - 32px); box-shadow: 0 12px 40px rgba(20, 40, 70, 0.18); }
@media (max-width: 820px) {
  body.dt-chat-mode .cp-overlay { align-items: stretch; padding: 42vh 0 0 0; }
  body.dt-chat-mode .cp-sheet { width: 100%; height: 100%; max-height: none; border-radius: 18px 18px 0 0; }
}

/* the palette button in the message box, and a swatch beside each Pantone name in a reply */
.dt-chat-palette svg { width: 22px; height: 22px; }
.dt-pantone { white-space: nowrap; }
.dt-pantone i { display: inline-block; width: 0.8em; height: 0.8em; border-radius: 50%; margin-right: 0.3em; vertical-align: -0.05em; border: 1px solid rgba(0, 0, 0, 0.18); }
[data-theme="dark"] .dt-pantone i { border-color: rgba(255, 255, 255, 0.3); }

/* a drawn crest / graphic in the chat (generate_crest / generate_graphic), on a light checker so a white line shows */
.dt-chat-drawn { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dt-chat-drawn a { display: block; width: 132px; height: 132px; border-radius: 12px; overflow: hidden; border: 1px solid var(--chat-bubble-border, rgba(0, 0, 0, 0.1)); background: #fff repeating-conic-gradient(#eef1f5 0 25%, transparent 0 50%) 0 0 / 14px 14px; }
.dt-chat-drawn img { width: 100%; height: 100%; object-fit: contain; padding: 8px; box-sizing: border-box; display: block; }

/* request_upload: the Upload button card */
.dt-chat-card-btn.primary { background: #1c1f24; border-color: #1c1f24; color: #fff; font-weight: 600; }
[data-theme="dark"] .dt-chat-card-btn.primary { background: #f2f4f7; border-color: #f2f4f7; color: #111; }
.dt-chat-card-btn.primary:disabled { opacity: .7; cursor: default; }
.dt-chat-card.upload .dt-chat-card-sub { margin-top: 4px; font-size: 13px; opacity: .75; }
.dt-chat-card.upload .dt-chat-card-actions { margin-top: 10px; }

/* the assistant bubble until its first word: Thinking with three soft dots (StudioChat.typewriter) */
.dt-chat-thinking { opacity: .7; }
/* the model working on a later step of the same reply (StudioChat.sendLive waiting) */
.dt-chat-wait { margin-top: 6px; font-size: .92em; }
.dt-chat-thinking i { font-style: normal; animation: dtChatDot 1.4s infinite both; }
.dt-chat-thinking i:nth-child(2) { animation-delay: .2s; }
.dt-chat-thinking i:nth-child(3) { animation-delay: .4s; }
@keyframes dtChatDot { 0%, 80%, 100% { opacity: .15; } 40% { opacity: 1; } }

/* voice (prototype, staff only: public/js/chat/VoiceLink.js): the mic in the message box, a ring while it
   listens, a pulse while it speaks; the last words on each side above the box; a request said out loud
   carries a small mic in its bubble */
.dt-chat-mic svg { width: 21px; height: 21px; }
.dt-chat-mic.on { color: #fff; background: #1f8f5f; }
.dt-chat-mic.on:hover { color: #fff; background: #1f8f5f; opacity: .9; }
.dt-chat-mic.connecting { background: #8a929c; animation: dtVoicePulse 1.2s ease-in-out infinite; }
.dt-chat-mic.listening { box-shadow: 0 0 0 3px rgba(31, 143, 95, .25); }
.dt-chat-mic.speaking { animation: dtVoicePulse 1s ease-in-out infinite; }
@keyframes dtVoicePulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(31, 143, 95, .45); } 50% { box-shadow: 0 0 0 7px rgba(31, 143, 95, 0); } }
.dt-chat-voicecap { font-size: .82em; line-height: 1.35; color: var(--chat-muted); padding: 0 12px 6px; }
.dt-chat-voicecap[hidden] { display: none; }
.dt-chat-voicecap .you { color: var(--chat-ink); }
.dt-chat-voicecap .agent { font-style: italic; }
.dt-chat-msg.user.dt-chat-voice .dt-chat-text::before {
  content: ''; display: inline-block; width: .85em; height: .85em; margin-right: .35em; vertical-align: -.08em; opacity: .7;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Crect x='9' y='3.5' width='6' height='11' rx='3'/%3E%3Cpath d='M5.5 11.5a6.5 6.5 0 0 0 13 0M12 18v2.5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Crect x='9' y='3.5' width='6' height='11' rx='3'/%3E%3Cpath d='M5.5 11.5a6.5 6.5 0 0 0 13 0M12 18v2.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
