.media-editor {
  margin: 20px 0;
}

.selection-tip {
  margin: -8px 0 18px;
  color: var(--muted);
  font-size: 12px;
}

.media-stage {
  position: relative;
  width: min(100%, 780px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #11131d;
  color: #b7bbca;
  text-align: center;
}

.mask-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 14px 0 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: var(--text, #202331);
  font-size: 13px;
}

.mask-toolbar > span {
  font-weight: 600;
  margin-right: 2px;
}

.mask-toolbar button,
.mask-toolbar select {
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
}

.mask-toolbar button {
  padding: 5px 10px;
  cursor: pointer;
}

.mask-toolbar button:hover,
.mask-toolbar button.active {
  border-color: var(--primary, #5b5bd6);
  background: color-mix(in srgb, var(--primary, #5b5bd6) 12%, transparent);
}

.mask-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  white-space: nowrap;
}

.mask-toolbar input[type="range"] {
  width: 110px;
  accent-color: var(--primary, #5b5bd6);
}

.mask-toolbar select {
  padding: 4px 8px;
  max-width: 190px;
}

.mask-toolbar .engine-label {
  margin-left: auto;
}

#mask-canvas {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.media-stage > span:only-child {
  display: block;
  padding: 90px 20px;
}

.source-media {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
}

.watermark-selection {
  position: absolute;
  z-index: 2;
  min-width: 12px;
  min-height: 12px;
  border: 2px solid #ff405d;
  background: rgba(255, 64, 93, .18);
  color: #fff;
  cursor: move;
  touch-action: none;
  user-select: none;
}

.watermark-selection span {
  position: absolute;
  top: -25px;
  left: -2px;
  padding: 2px 7px;
  border-radius: 4px 4px 0 0;
  background: #ff405d;
  font-size: 11px;
  white-space: nowrap;
}

.media-dimensions {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.watermark-coordinates {
  grid-template-columns: repeat(4, 1fr);
}

.processed-preview {
  margin-top: 22px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfbfd;
}

.processed-preview img,
.processed-preview video {
  display: block;
  max-width: 100%;
  max-height: 520px;
  margin: 0 auto;
}

.dark .processed-preview {
  background: #191a28;
}

.dark .mask-toolbar {
  background: #191a28;
  color: #eef0f7;
}

.dark .mask-toolbar button,
.dark .mask-toolbar select {
  background: #222438;
  color: #eef0f7;
}

@media (max-width: 760px) {
  .watermark-coordinates { grid-template-columns: repeat(2, 1fr); }
  .mask-toolbar .engine-label { margin-left: 0; width: 100%; }
  .mask-toolbar select { flex: 1; max-width: none; }
}
