* {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

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

:root {
  --option-row-w: 50px;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    sans-serif;
  background: #0b0e0e;
  color: #e4e4e7;
}

body.side-panel-resizing {
  cursor: row-resize;
  user-select: none;
}

.editor-root {
  height: 100%;
  display: grid;
  grid-template-rows: 56px 1fr;
  overflow: hidden;
}

.editor-main {
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 12px;
  padding: 12px;
  overflow: hidden;
}

.editor-header {
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
}

.toolbar {
  display: flex;
  width: 100%;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.zoom-controls {
  display: inline-flex;
  gap: 6px;
}

#exportSelected {
  margin-left: auto;
}

.button {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #e4e4e7;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
}

.button.icon-only {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.button.icon-only svg {
  width: 16px;
  height: 16px;
  display: block;
}

#duplicateAction svg,
#exportSelected svg {
  width: 18px;
  height: 18px;
}

#textAction svg {
  width: 16px;
  height: 16px;
}

#customTemplateAction svg {
  width: 18px;
  height: 18px;
}

#removeBgAction svg {
  width: 20px;
  height: 20px;
}

#upscaleAction svg {
  width: 18px;
  height: 18px;
}

#modeFilter svg {
  width: 18px;
  height: 18px;
}

#modeShadow svg {
  width: 18px;
  height: 18px;
}

#modeRotate svg {
  width: 17px;
  height: 17px;
}

[data-hint] {
  position: relative;
}

[data-hint]::after {
  content: attr(data-hint);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  font-size: 11px;
  line-height: 1.1;
  color: #f4f4f5;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  background: rgba(10, 10, 12, 0.96);
  padding: 5px 7px;
  transition:
    opacity 120ms ease,
    transform 120ms ease;
  z-index: 300;
}

[data-hint]:hover::after,
[data-hint]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.editor-header [data-hint]::after {
  bottom: auto;
  top: calc(100% + 8px);
}

.button.active {
  border-color: rgba(167, 243, 208, 0.8);
  background: rgba(16, 185, 129, 0.18);
}

.hidden-input {
  display: none;
}

.editor-stage {
  --editor-zoom: 1;
  --editor-offset-x: 0px;
  --editor-offset-y: 0px;
  --grid-size: 32px;
  --grid-offset-x: 0px;
  --grid-offset-y: 0px;
  position: relative;
  overflow: hidden;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: radial-gradient(circle at 50% 0%, #1b2623, #101514 48%, #0b0e0e);
}

.snap-guide {
  position: absolute;
  pointer-events: none;
  z-index: 90;
  opacity: 0.92;
}

.snap-guide-vertical {
  top: 0;
  bottom: 0;
  width: 1px;
  border-left: 1px dashed rgba(96, 165, 250, 0.92);
  transform: translateX(-0.5px);
}

.snap-guide-horizontal {
  left: 0;
  right: 0;
  height: 1px;
  border-top: 1px dashed rgba(96, 165, 250, 0.92);
  transform: translateY(-0.5px);
}

body.template-mode #layersSection,
body.template-mode #sidePanelResizeHandle {
  display: none;
}

body.template-mode .layers-panel {
  grid-template-rows: minmax(140px, 1fr);
}

body.template-mode #modeCrop,
body.template-mode #modeRotate,
body.template-mode #modeFilter,
body.template-mode #modeShadow,
body.template-mode #addAction,
body.template-mode #textAction,
body.template-mode #duplicateAction,
body.template-mode #deleteAction,
body.template-mode #removeBgAction,
body.template-mode #upscaleAction {
  display: none;
}

.template-input-block {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px;
  display: grid;
  gap: 8px;
}

.template-input-block-title {
  margin: 0;
  font-size: 11px;
  color: rgba(228, 228, 231, 0.82);
  font-weight: 700;
}

.template-note {
  margin: 0;
  font-size: 11px;
  color: rgba(228, 228, 231, 0.72);
}

.template-upload-control {
  display: grid;
  gap: 6px;
}

.template-dropzone {
  border: 1px dashed rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  padding: 9px 10px;
  font-size: 11px;
  color: rgba(228, 228, 231, 0.8);
  text-align: center;
  cursor: pointer;
  transition:
    border-color 120ms ease,
    background-color 120ms ease;
}

.template-dropzone:hover,
.template-dropzone.drag-over {
  border-color: rgba(167, 243, 208, 0.84);
  background: rgba(16, 185, 129, 0.16);
}

.layers-panel {
  --options-panel-height: 60%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  padding: 10px;
  overflow: hidden;
  display: grid;
  grid-template-rows:
    minmax(140px, var(--options-panel-height))
    8px
    minmax(120px, 1fr);
  gap: 8px;
}

.side-section {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(10, 10, 12, 0.25);
  padding: 8px;
  min-height: 0;
}

.options-section {
  overflow: auto;
}

.layers-section {
  overflow: auto;
}

.side-panel-resize-handle {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  cursor: row-resize;
  position: relative;
  touch-action: none;
}

.side-panel-resize-handle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  transform: translate(-50%, -50%);
}

.layers-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(228, 228, 231, 0.9);
}

.layers-list {
  display: grid;
  gap: 6px;
}

.options-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-content: start;
}

.option-caption {
  grid-column: 1;
  margin: 0;
  font-size: 11px;
  color: rgba(228, 228, 231, 0.75);
}

.option-row {
  display: grid;
  grid-template-columns: minmax(56px, auto) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.option-row.full {
  grid-column: 1;
  grid-template-columns: minmax(0, 1fr);
}

.option-row.full > label {
  display: none;
}

.option-row label {
  font-size: 11px;
  color: rgba(228, 228, 231, 0.82);
  white-space: nowrap;
}

.option-row > :last-child {
  min-width: 0;
}

.option-input-combo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(72px, 92px);
  gap: 6px;
}

.option-row input[type="number"],
.option-row input[type="text"],
.option-row .option-select,
.option-row textarea,
.option-row input[type="color"] {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #e4e4e7;
  padding: 6px 8px;
  font-size: 12px;
}

.option-textarea {
  min-height: 86px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.45;
  -webkit-user-select: text;
  user-select: text;
}

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

.metric-field {
  display: flex;
  gap: 4px;
}

.metric-label {
  font-size: 10px;
  display: flex;
  align-items: center;
  color: rgba(228, 228, 231, 0.72);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.inline-name-display {
  width: 100%;
  min-height: 24px;
  border: 1px dashed transparent;
  border-radius: 4px;
  background: transparent;
  color: #e4e4e7;
  padding: 2px 4px;
  font-size: 12px;
  line-height: 1.4;
  cursor: text;
}

.inline-name-display:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
}

.option-name-input,
.layer-name-input {
  width: 100%;
  border: 1px solid rgba(167, 243, 208, 0.55);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #e4e4e7;
  padding: 6px 8px;
  font-size: 12px;
}

.option-row input[type="color"] {
  height: 34px;
  padding: 2px;
}

.option-row input[type="color"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.custom-color-inline-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  gap: 6px;
  align-items: center;
}

.color-hex-input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #e4e4e7;
  padding: 6px 8px;
  font-size: 12px;
  text-transform: uppercase;
}

.color-native-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: auto;
  cursor: pointer;
}

.color-current-box {
  position: relative;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 5px;
  background: #ffffff;
  cursor: pointer;
  overflow: hidden;
}

.color-hex-input:disabled,
.color-current-box:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.preset-palette {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.preset-color {
  width: 100%;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 5px;
  cursor: pointer;
}

.preset-color[data-hint]::after {
  bottom: calc(100% + 6px);
}

.preset-color.active {
  box-shadow: 0 0 0 2px rgba(167, 243, 208, 0.72);
}

.preset-color:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.option-button {
  width: 100%;
  padding: 7px 9px;
}

.filter-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--option-row-w);
  gap: 6px;
  align-items: center;
}

.filter-range {
  width: 100%;
  accent-color: #a8a8a8;
  height: 4px;
}

.filter-value-label {
  font-size: 11px;
  color: rgba(228, 228, 231, 0.82);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.filter-value-input {
  width: var(--option-row-w);
  min-width: var(--option-row-w);
  max-width: var(--option-row-w);
  height: 25px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: #e4e4e7;
  font-size: 10px;
  line-height: 1;
  padding: 1px 2px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  appearance: textfield;
}

.filter-value-input::-webkit-outer-spin-button,
.filter-value-input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.option-divider {
  height: 1px;
  margin: 8px 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 0.22),
    rgba(255, 255, 255, 0)
  );
}

.danger-button {
  border-color: rgba(248, 113, 113, 0.66);
  background: rgba(239, 68, 68, 0.16);
}

.editor-stage.eyedropper-active {
  cursor: crosshair;
}

.editor-stage.eyedropper-active .hint {
  color: rgba(253, 224, 71, 0.95);
}

.eyedropper-preview {
  position: absolute;
  z-index: 70;
  pointer-events: none;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(10, 10, 12, 0.92);
  color: #f4f4f5;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 11px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
}

.eyedropper-preview-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background-image:
    linear-gradient(45deg, #9ca3af 25%, transparent 25%),
    linear-gradient(-45deg, #9ca3af 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #9ca3af 75%),
    linear-gradient(-45deg, transparent 75%, #9ca3af 75%);
  background-size: 8px 8px;
  background-position:
    0 0,
    0 4px,
    4px -4px,
    -4px 0;
}

.eyedropper-preview-code {
  letter-spacing: 0.04em;
  font-weight: 600;
}

.empty-option {
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  color: rgba(228, 228, 231, 0.72);
}

.text-popup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 420;
  background: rgba(0, 0, 0, 0.62);
  display: grid;
  place-items: center;
  padding: 20px;
}

.text-popup {
  width: min(560px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: rgba(16, 18, 20, 0.98);
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.45);
  padding: 14px;
  display: grid;
  gap: 10px;
}

.text-popup-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.text-popup-label {
  font-size: 11px;
  color: rgba(228, 228, 231, 0.82);
}

.text-popup-input,
.text-popup-textarea,
.text-popup-color {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #e4e4e7;
  padding: 7px 8px;
  font-size: 12px;
}

.text-popup-textarea {
  min-height: 110px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.45;
  -webkit-user-select: text;
  user-select: text;
}

.text-popup-preview {
  min-height: 86px;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  padding: 10px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%) 0 0 /
      14px 14px,
    linear-gradient(-45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%) 0
      7px / 14px 14px,
    rgba(255, 255, 255, 0.02);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.text-popup-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.text-popup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.layer-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 7px 8px;
  background: rgba(24, 24, 27, 0.5);
  font-size: 12px;
  color: rgba(228, 228, 231, 0.9);
  cursor: pointer;
  display: block;
}

.layer-item-top {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}

.layer-depth-marker {
  color: rgba(125, 211, 252, 0.8);
  font-size: 11px;
  line-height: 1;
}

.layer-name-display {
  display: block;
}

.layer-item-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-item-badge {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 10px;
  color: rgba(228, 228, 231, 0.8);
}

.layer-item-meta {
  margin-top: 4px;
  margin-left: 18px;
  font-size: 10px;
  color: rgba(228, 228, 231, 0.62);
  letter-spacing: 0.02em;
}

.layer-item.parent {
  border-color: rgba(125, 211, 252, 0.45);
}

.layer-item.parent .layer-item-badge {
  border-color: rgba(125, 211, 252, 0.6);
  color: rgba(186, 230, 253, 0.95);
}

.layer-item.active {
  border-color: rgba(167, 243, 208, 0.88);
  background: rgba(16, 185, 129, 0.16);
}

.layer-item.active .layer-item-badge {
  border-color: rgba(167, 243, 208, 0.9);
  color: rgba(167, 243, 208, 0.95);
}

.layer-item.dragging {
  opacity: 0.55;
}

.layer-item.drag-over {
  border-color: rgba(125, 211, 252, 0.92);
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.36);
}

.layers-list.drag-over-root {
  border: 1px dashed rgba(125, 211, 252, 0.65);
  border-radius: 8px;
  padding: 4px;
}

.editor-grid {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-position: var(--grid-offset-x) var(--grid-offset-y);
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to right, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  background-size:
    var(--grid-size) var(--grid-size),
    var(--grid-size) var(--grid-size),
    calc(var(--grid-size) * 4) calc(var(--grid-size) * 4),
    calc(var(--grid-size) * 4) calc(var(--grid-size) * 4);
}

.layer-root {
  position: absolute;
  inset: 0;
  width: calc(100% / var(--editor-zoom));
  height: calc(100% / var(--editor-zoom));
  transform-origin: 0 0;
  transform: translate(var(--editor-offset-x), var(--editor-offset-y))
    scale(var(--editor-zoom));
}

.layer {
  position: absolute;
  left: 120px;
  top: 80px;
  width: 420px;
  height: 300px;
  overflow: hidden;
  border: 1px solid rgba(167, 243, 208, 0.9);
  background: transparent;
  isolation: isolate;
}

.layer-inset-shadow-overlay {
  position: absolute;
  pointer-events: none;
  z-index: 2;
}

.layer.magic-removing {
  border-color: rgba(251, 191, 36, 0.95);
  box-shadow:
    0 0 0 1px rgba(251, 191, 36, 0.34),
    0 0 22px rgba(251, 191, 36, 0.65),
    0 0 44px rgba(56, 189, 248, 0.36);
  animation: layer-magic-pulse 1.15s ease-in-out infinite;
}

.layer.magic-removing::before {
  content: "";
  position: absolute;
  top: -15%;
  left: -35%;
  width: 38%;
  height: 130%;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.22) 45%,
    rgba(125, 211, 252, 0.2) 55%,
    rgba(255, 255, 255, 0) 100%
  );
  mix-blend-mode: screen;
  filter: blur(1px);
  animation: layer-scan-sweep 1.25s cubic-bezier(0.22, 0.61, 0.36, 1) infinite;
}

.layer.magic-removing::after {
  content: "";
  position: absolute;
  inset: -35%;
  pointer-events: none;
  background:
    radial-gradient(
      circle at 30% 20%,
      rgba(250, 204, 21, 0.38),
      rgba(250, 204, 21, 0) 26%
    ),
    radial-gradient(
      circle at 78% 72%,
      rgba(34, 211, 238, 0.3),
      rgba(34, 211, 238, 0) 28%
    ),
    conic-gradient(
      from 0deg,
      rgba(250, 204, 21, 0),
      rgba(250, 204, 21, 0.24),
      rgba(56, 189, 248, 0.22),
      rgba(250, 204, 21, 0)
    );
  mix-blend-mode: screen;
  opacity: 0.9;
  filter: blur(13px);
  animation: layer-magic-rotate 1.6s linear infinite;
}

.layer.magic-removing img {
  filter: saturate(1.12) contrast(1.03);
  animation: layer-content-shimmer 1.15s ease-in-out infinite;
}

.layer.magic-applied::after {
  content: "";
  position: absolute;
  inset: -25%;
  pointer-events: none;
  background: radial-gradient(
    circle,
    rgba(74, 222, 128, 0.48) 0%,
    rgba(16, 185, 129, 0.28) 35%,
    rgba(16, 185, 129, 0) 70%
  );
  filter: blur(12px);
  animation: layer-applied-burst 0.9s ease-out 1;
}

.layer.magic-applied {
  border-color: rgba(74, 222, 128, 0.95);
  box-shadow:
    0 0 0 1px rgba(74, 222, 128, 0.42),
    0 0 22px rgba(74, 222, 128, 0.55);
  animation: layer-applied-flash 0.95s ease-out 1;
}

@keyframes layer-magic-pulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.008);
  }
}

@keyframes layer-scan-sweep {
  0% {
    transform: translateX(0) rotate(2deg);
    opacity: 0;
  }

  14% {
    opacity: 1;
  }

  100% {
    transform: translateX(420%) rotate(2deg);
    opacity: 0;
  }
}

@keyframes layer-magic-rotate {
  to {
    transform: rotate(360deg);
  }
}

@keyframes layer-content-shimmer {
  0%,
  100% {
    filter: saturate(1.1) contrast(1.03) brightness(1);
  }

  50% {
    filter: saturate(1.2) contrast(1.06) brightness(1.04);
  }
}

@keyframes layer-applied-burst {
  0% {
    opacity: 0.95;
    transform: scale(0.75);
  }

  100% {
    opacity: 0;
    transform: scale(1.14);
  }
}

@keyframes layer-applied-flash {
  0% {
    filter: saturate(1) brightness(1);
    box-shadow:
      0 0 0 1px rgba(74, 222, 128, 0.42),
      0 0 22px rgba(74, 222, 128, 0.55);
  }

  45% {
    filter: saturate(1.24) brightness(1.08);
    box-shadow:
      0 0 0 1px rgba(74, 222, 128, 0.72),
      0 0 30px rgba(74, 222, 128, 0.74);
  }

  100% {
    filter: saturate(1) brightness(1);
    box-shadow: none;
  }
}

.layer img {
  display: block;
  pointer-events: none;
}

.selection-box {
  position: absolute;
  border: 2px solid rgba(167, 243, 208, 0.95);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.35);
  pointer-events: none;
  display: none;
  z-index: 20;
}

.rotate-handle {
  position: absolute;
  left: 50%;
  top: -28px;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(2, 44, 34, 0.95);
  background: #7dd3fc;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.26);
  cursor: grab;
  pointer-events: auto;
  display: none;
}

.rotate-handle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 14px;
  width: 1px;
  height: 12px;
  transform: translateX(-50%);
  background: rgba(125, 211, 252, 0.85);
}

.editor-stage.rotate-mode .selection-box {
  border-color: rgba(125, 211, 252, 0.95);
  box-shadow: 0 0 0 1px rgba(2, 132, 199, 0.35);
}

.editor-stage.rotate-mode .selection-handle {
  display: none;
}

.editor-stage.rotate-mode .rotate-handle {
  display: block;
}

.selection-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(2, 44, 34, 0.9);
  background: rgba(167, 243, 208, 1);
  pointer-events: auto;
}

.selection-handle.nw {
  left: -6px;
  top: -6px;
  cursor: nwse-resize;
}

.selection-handle.ne {
  right: -6px;
  top: -6px;
  cursor: nesw-resize;
}

.selection-handle.sw {
  left: -6px;
  bottom: -6px;
  cursor: nesw-resize;
}

.selection-handle.se {
  right: -6px;
  bottom: -6px;
  cursor: nwse-resize;
}

.selection-handle.n {
  left: 50%;
  top: -6px;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.selection-handle.e {
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.selection-handle.s {
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.selection-handle.w {
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.crop-box {
  position: absolute;
  border: 3px dashed rgba(253, 224, 71, 0.98);
  background: transparent;
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(202, 138, 4, 0.55),
    inset 0 0 0 1px rgba(17, 24, 39, 0.6);
  pointer-events: none;
  display: none;
  z-index: 30;
}

.crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(17, 24, 39, 0.9);
  background: #fde047;
  pointer-events: auto;
}

.crop-handle.nw {
  left: -7px;
  top: -7px;
  cursor: nwse-resize;
}

.crop-handle.ne {
  right: -7px;
  top: -7px;
  cursor: nesw-resize;
}

.crop-handle.sw {
  left: -7px;
  bottom: -7px;
  cursor: nesw-resize;
}

.crop-handle.se {
  right: -7px;
  bottom: -7px;
  cursor: nwse-resize;
}

.crop-handle.n {
  left: 50%;
  top: -7px;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.crop-handle.e {
  right: -7px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.crop-handle.s {
  left: 50%;
  bottom: -7px;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.crop-handle.w {
  left: -7px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.marquee {
  position: absolute;
  border: 1px dashed rgba(125, 211, 252, 0.9);
  background: rgba(56, 189, 248, 0.15);
  pointer-events: none;
  display: none;
}

.hint {
  position: absolute;
  left: 14px;
  bottom: 10px;
  font-size: 11px;
  color: rgba(228, 228, 231, 0.75);
}

.context-menu {
  position: fixed;
  z-index: 120;
  min-width: 180px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: rgba(10, 10, 12, 0.96);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
  padding: 6px;
  display: none;
}

.context-menu.show {
  display: grid;
  gap: 3px;
}

.context-menu-item {
  border: 0;
  background: transparent;
  color: #e4e4e7;
  text-align: left;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 12px;
  cursor: pointer;
}

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

.context-menu-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.context-menu-separator {
  height: 1px;
  margin: 4px 2px;
  background: rgba(255, 255, 255, 0.14);
}
