.canvas-surface {
  position: relative;
  flex: 0 0 auto;
  margin: 0 auto;
  background: #fff;
  box-shadow: var(--shadow);
  contain: layout paint style;
  isolation: isolate;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.editor-canvas,
.canvas-overlay {
  position: absolute;
  inset: 0;
  display: block;
}

.editor-canvas {
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.canvas-overlay {
  pointer-events: none;
  overflow: visible;
}

.canvas-selection {
  position: absolute;
  transform-origin: center center;
  outline: 1.5px solid #111;
  outline-offset: 2px;
  pointer-events: none;
  will-change: left, top, width, height, transform;
}

.canvas-resize-handle {
  position: absolute;
  right: -10px;
  bottom: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid #111;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  pointer-events: auto;
  touch-action: none;
}

html[data-theme="dark"] .canvas-selection,
html[data-theme="dark"] .canvas-resize-handle {
  outline-color: #fff;
  border-color: #111;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] .canvas-selection {
    outline-color: #fff;
  }
}

@media (min-width: 980px) {
  .canvas-resize-handle {
    width: 18px;
    height: 18px;
    right: -9px;
    bottom: -9px;
  }
}
