.sketch-overlay {
  padding: 16px;
}

.sketch-window {
  width: 100%;
  height: calc(100dvh - 32px);
  max-width: 1800px;
  max-height: calc(100dvh - 32px);
}

.sketch-layout {
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.sketch-area {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: var(--background);
  overflow: hidden;
}

.sketch-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  cursor: crosshair;
}

.sketch-viewport[data-tool="hand"] {
  cursor: grab;
}

.sketch-viewport[data-tool="hand"]:active {
  cursor: grabbing;
}

.sketch-viewport[data-tool="eyedropper"] {
  cursor: crosshair;
}

.sketch-stage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  background: var(--canvas-background);
  box-shadow: 0 8px 40px var(--shadow);
  pointer-events: none;
}

.sketch-layer-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.sketch-crop-rect {
  position: absolute;
  z-index: 4;
  border: 2px dashed var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 4096px var(--overlay);
  pointer-events: none;
}

.sketch-toolbar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100% - 24px);
  padding: 6px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 8px 32px var(--shadow);
  transform: translateX(-50%);
  overflow-x: auto;
  user-select: none;
}

.sketch-tool-button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  padding: 8px;
  border-radius: 6px;
  color: var(--secondary);
  transition: background 120ms ease, color 120ms ease, transform 120ms ease;
}

.sketch-tool-button:hover {
  background: var(--hover);
  color: var(--white);
}

.sketch-tool-button:active {
  transform: scale(0.92);
}

.sketch-tool-button.active {
  background: var(--brand);
  color: var(--black);
}

.sketch-tool-button svg {
  width: 22px;
  height: 22px;
}

.sketch-zoom-label {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 8;
  padding: 4px 8px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--sidebar);
  color: var(--secondary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.sketch-dimension-status {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.sketch-inspector {
  display: flex;
  flex-direction: column;
  flex: 0 0 264px;
  gap: 16px;
  width: 264px;
  min-width: 0;
  min-height: 0;
  padding: 12px;
  border-left: 2px solid var(--border);
  background: var(--sidebar);
  overflow-x: hidden;
  overflow-y: auto;
}

.sketch-inspector-section {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 12px;
  min-width: 0;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.sketch-inspector-section:last-child {
  border: 0;
  padding-bottom: 0;
}

.sketch-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.sketch-section-header svg {
  width: 16px;
  height: 16px;
  color: var(--secondary);
}

.sketch-dimensions,
.sketch-rgb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sketch-number-field {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 4px 8px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--muted);
  font-size: 12px;
}

.sketch-number-field:focus-within {
  border-color: var(--brand);
}

.sketch-number-field input {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 24px;
  padding: 0;
  border: 0;
  outline: none;
  appearance: textfield;
  background: var(--transparent);
  color: var(--text);
  font-size: 12px;
}

.sketch-number-field input::-webkit-inner-spin-button,
.sketch-number-field input::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

.sketch-unit-label {
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.sketch-secondary-button {
  min-height: 32px;
  padding: 6px 12px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--secondary);
  font-size: 12px;
}

.sketch-secondary-button:hover {
  background: var(--hover);
  color: var(--text);
}

.sketch-option-group {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 6px;
  background: var(--background);
}

.sketch-option-button {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 32px;
  padding: 6px;
  border-radius: 4px;
  color: var(--secondary);
}

.sketch-option-button.active {
  background: var(--selected);
  color: var(--brand);
}

.sketch-option-button svg {
  width: 18px;
  height: 18px;
}

.sketch-range-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sketch-range-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--secondary);
  font-size: 12px;
}

.sketch-range-value {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.sketch-inspector input[type="range"] {
  appearance: none;
  width: 100%;
  height: 16px;
  margin: 0;
  border: 0;
  outline: none;
  border-radius: 8px;
  background: var(--border);
  cursor: pointer;
}

.sketch-inspector input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--background);
  border-radius: 50%;
  background: var(--brand);
}

.sketch-inspector input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid var(--background);
  border-radius: 50%;
  background: var(--brand);
}

.sketch-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--secondary);
  font-size: 12px;
}

.sketch-checkbox-label input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand);
}

.sketch-tool-description {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 160%;
}

.sketch-color-picker {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.sketch-color-square {
  position: relative;
  width: 100%;
  height: 132px;
  border-radius: 6px;
  background: linear-gradient(to top, var(--black), var(--transparent)), linear-gradient(to right, var(--white), var(--picker-hue));
  overflow: hidden;
  touch-action: none;
  cursor: crosshair;
}

.sketch-color-cursor {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid var(--white);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--shadow);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.sketch-inspector input.sketch-hue {
  background: linear-gradient(to right, #FF0000, #FFFF00, #00FF00, #00FFFF, #0000FF, #FF00FF, #FF0000);
}

.sketch-hex-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sketch-color-swatch {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  border-radius: 6px;
}

.sketch-hex-input {
  flex: 1;
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 6px 8px;
  border: 2px solid var(--border);
  border-radius: 6px;
  outline: none;
  background: var(--background);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
}

.sketch-hex-input:focus {
  border-color: var(--brand);
}

.sketch-layer-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  max-height: 280px;
  overflow-y: auto;
}

.sketch-layer-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 40px;
  padding: 4px;
  border: 2px solid var(--transparent);
  border-radius: 6px;
  background: var(--surface);
}

.sketch-layer-row.active {
  border-color: var(--brand);
  background: var(--selected);
}

.sketch-layer-row .icon-button {
  width: 24px;
  height: 24px;
  padding: 4px;
}

.sketch-layer-row .icon-button svg {
  width: 14px;
  height: 14px;
}

.sketch-layer-thumbnail {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 28px;
  border-radius: 4px;
  background: var(--canvas-checker-light);
  overflow: hidden;
  cursor: pointer;
}

.sketch-layer-thumbnail canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sketch-layer-name {
  flex: 1;
  min-width: 0;
  padding: 4px;
  color: var(--text);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
}

.sketch-layer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
}

.sketch-layer-actions .icon-button {
  width: 28px;
  height: 28px;
  padding: 4px;
}

.sketch-layer-actions .icon-button svg {
  width: 16px;
  height: 16px;
}

.sketch-inspector-toggle {
  display: none;
}

.sketch-notice {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 12;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--brand);
  color: var(--black);
  font-size: 12px;
  text-align: center;
  transform: translateX(-50%);
}