#web-image-editor * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

#web-image-editor {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0 auto;
  padding: 20px 16px 40px;
  color: #2d3748;
}

#web-image-editor .sticky-note {
  background: #fffbeb;
  border-left: 4px solid #f6c90e;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 20px;
  color: #78350f;
}

#web-image-editor #count-display {
  font-weight: 700;
  color: #d97706;
}

#web-image-editor #count-display.loading {
  color: #bbb;
}

#web-image-editor .app-title {
  font-size: 22px;
  font-weight: 800;
  color: #1a202c;
  margin-bottom: 4px;
  letter-spacing: -0.4px;
}

#web-image-editor .app-subtitle {
  font-size: 14px;
  color: #718096;
  margin-bottom: 20px;
  text-align: center;
}

#web-image-editor .toolbar {
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

#web-image-editor.crop-mode-active .toolbar,
#web-image-editor.crop-mode-active .zoom-row,
#web-image-editor.crop-mode-active .dl-row,
#web-image-editor.crop-mode-active .layer-panel {
  pointer-events: none;
  opacity: 0.55;
  position: relative;
}

#web-image-editor.crop-mode-active #btn-white-canvas,
#web-image-editor.crop-mode-active #btn-rotate-workspace,
#web-image-editor.crop-mode-active #btn-cut-out {
  display: none;
}

#web-image-editor .rotate-workspace-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10050;
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
}

#web-image-editor .rotate-workspace-box {
  background: #fff;
  border-radius: 14px;
  padding: 22px 24px;
  max-width: min(92vw, 520px);
  width: 100%;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  margin: auto;
  flex-shrink: 0;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

#web-image-editor .rotate-workspace-title {
  font-size: 17px;
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 8px;
}

#web-image-editor .rotate-workspace-desc {
  font-size: 13px;
  color: #718096;
  margin: 0 0 16px;
  line-height: 1.5;
}

#web-image-editor .rotate-workspace-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

#web-image-editor .rotate-workspace-row-4 .rotate-workspace-btn {
  min-width: 72px;
  flex: 1 1 20%;
}

#web-image-editor .rotate-workspace-btn {
  flex: 1;
  min-width: 140px;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f7fafc;
  font-size: 13px;
  font-weight: 600;
  color: #2d3748;
  cursor: pointer;
}

#web-image-editor .rotate-workspace-btn:hover {
  background: #edf2f7;
  border-color: #cbd5e0;
}

#web-image-editor .rotate-workspace-manual {
  border-top: 1px solid #e2e8f0;
  padding-top: 16px;
  margin-bottom: 14px;
}

#web-image-editor .rotate-workspace-manual-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 8px;
}

#web-image-editor #rotate-manual-deg {
  width: 100%;
  max-width: 320px;
  margin-bottom: 6px;
  accent-color: #4f46e5;
}

#web-image-editor .rotate-manual-val {
  display: inline-block;
  min-width: 48px;
  font-size: 14px;
  font-weight: 700;
  color: #4f46e5;
  margin-right: 12px;
}

#web-image-editor .rotate-workspace-apply {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

#web-image-editor .rotate-workspace-apply:hover {
  opacity: 0.92;
}

#web-image-editor .rotate-workspace-close {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  color: #4a5568;
  cursor: pointer;
}

#web-image-editor .rotate-workspace-close:hover {
  background: #f7fafc;
}

#web-image-editor .toolbar-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

#web-image-editor .toolbar-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#web-image-editor .toolbar-col-upload {
  flex-shrink: 0;
}

#web-image-editor .toolbar-col-upload .btn-upload {
  min-width: 180px;
  width: 100%;
  box-sizing: border-box;
  justify-content: center;
}

#web-image-editor .toolbar-col-main {
  flex: 1;
  min-width: 0;
  align-items: flex-start;
}

#web-image-editor .toolbar-tools-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

#web-image-editor .btn-upload {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(102,126,234,0.35);
  white-space: nowrap;
  user-select: none;
}

#web-image-editor .btn-upload:hover {
  opacity: 0.88;
  box-shadow: 0 4px 14px rgba(102,126,234,0.45);
}

#web-image-editor .tool-group {
  display: flex;
  gap: 3px;
  background: #edf2f7;
  border-radius: 10px;
  padding: 4px;
}

#web-image-editor .tool-btn {
  padding: 6px 13px;
  border: none;
  border-radius: 7px;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: #4a5568;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}

#web-image-editor .tool-btn:hover {
  background: #fff;
  color: #2d3748;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

#web-image-editor .tool-btn.active {
  background: #fff;
  color: #4f46e5;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(79,70,229,0.18);
}

#web-image-editor .style-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

#web-image-editor .style-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #4a5568;
  font-weight: 500;
  white-space: nowrap;
}

#web-image-editor #watermark-opacity-wrap {
  display: none;
}

#web-image-editor #watermark-opacity-wrap.watermark-toolbar-visible {
  display: flex !important;
  align-items: center;
  gap: 6px;
}

#web-image-editor #shape-fill-wrap {
  display: none;
}

#web-image-editor #shape-fill-wrap.shape-fill-visible {
  display: flex !important;
  align-items: center;
  gap: 6px;
}

#web-image-editor #shape-fill {
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
  accent-color: #4a5568;
}

#web-image-editor #color-picker {
  width: 34px;
  height: 28px;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  padding: 2px;
  cursor: pointer;
  background: none;
  vertical-align: middle;
}

#web-image-editor #stroke-width {
  width: 80px;
  accent-color: #4f46e5;
  cursor: pointer;
  vertical-align: middle;
}

#web-image-editor #font-picker {
  min-width: 120px;
  max-width: 180px;
  padding: 4px 8px;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
  color: #4a5568;
}

#web-image-editor #font-picker:hover {
  border-color: #cbd5e0;
}

#web-image-editor #font-picker:focus {
  outline: none;
  border-color: #4f46e5;
}

#web-image-editor #stroke-val {
  font-weight: 700;
  color: #4f46e5;
  min-width: 18px;
  text-align: right;
}

#web-image-editor .action-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

#web-image-editor .action-btns-row {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}

#web-image-editor .action-btns button {
  padding: 6px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  color: #4a5568;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}

#web-image-editor .action-btns button:hover:not(:disabled) {
  background: #f7fafc;
  border-color: #a0aec0;
  color: #2d3748;
}

#web-image-editor .action-btns button:disabled {
  opacity: 0.45;
  cursor: default;
  background: #f7fafc;
  color: #a0aec0;
}

#web-image-editor #btn-rm-all:hover:not(:disabled) {
  background: #fff5f5;
  border-color: #feb2b2;
  color: #c53030;
}

#web-image-editor .action-btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

#web-image-editor .action-btn-icon-svg {
  display: inline-flex;
  line-height: 0;
}

#web-image-editor .action-btn-icon-svg svg {
  display: block;
}

#web-image-editor .cut-mode-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}

#web-image-editor .cut-mode-label {
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
}

#web-image-editor .cut-mode-exec-btn {
  padding: 6px 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

#web-image-editor .cut-mode-exec-btn:hover {
  background: linear-gradient(135deg, #4338ca, #4f46e5);
}

#web-image-editor .has-tooltip {
  position: relative;
}

#web-image-editor .has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  width: max-content;
  max-width: 240px;
  padding: 8px 10px;
  border-radius: 6px;
  background: #2d3748;
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 30;
}

#web-image-editor .has-tooltip:hover::after,
#web-image-editor .has-tooltip:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

#web-image-editor .cut-mode-cancel-btn {
  padding: 6px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
  cursor: pointer;
  transition: all 0.2s;
}

#web-image-editor .cut-mode-cancel-btn:hover {
  background: #f7fafc;
  border-color: #cbd5e0;
}

#web-image-editor .bg-remove-mode-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

#web-image-editor .bg-remove-target-hint {
  font-size: 12px;
  font-weight: 500;
  color: #718096;
  line-height: 1.35;
}

#web-image-editor .bg-remove-tol-label,
#web-image-editor .bg-remove-global-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
  white-space: nowrap;
}

#web-image-editor #bg-remove-tolerance {
  width: 100px;
  accent-color: #4f46e5;
  cursor: pointer;
  vertical-align: middle;
}

#web-image-editor #bg-remove-tol-val {
  min-width: 20px;
  font-weight: 700;
  color: #4f46e5;
}

#web-image-editor .bg-remove-global-label input {
  margin: 0;
  cursor: pointer;
}

#web-image-editor .workspace-row {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 14px;
}

#web-image-editor .workspace-row .canvas-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

#web-image-editor .layer-panel {
  flex: 0 0 220px;
  width: 220px;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(70vh, 720px);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

#web-image-editor .layer-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: #2d3748;
  padding-bottom: 6px;
  border-bottom: 1px solid #e2e8f0;
}

#web-image-editor .layer-panel-base {
  font-size: 12px;
  font-weight: 600;
  color: #718096;
  background: #edf2f7;
  border-radius: 8px;
  padding: 8px 10px;
}

#web-image-editor .layer-panel-base.is-ready {
  color: #4a5568;
}

#web-image-editor .layer-list {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 80px;
}

#web-image-editor .layer-list-empty {
  font-size: 12px;
  color: #a0aec0;
  padding: 10px 4px;
  line-height: 1.5;
}

#web-image-editor .layer-item {
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fff;
  padding: 2px;
  cursor: grab;
  position: relative;
}

#web-image-editor .layer-item:active {
  cursor: grabbing;
}

#web-image-editor .layer-item.is-dragging {
  opacity: 0.45;
}

#web-image-editor .layer-item.drag-over-before::before,
#web-image-editor .layer-item.drag-over-after::after {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  height: 2px;
  background: #4f46e5;
  border-radius: 1px;
  pointer-events: none;
}

#web-image-editor .layer-item.drag-over-before::before {
  top: -2px;
}

#web-image-editor .layer-item.drag-over-after::after {
  bottom: -2px;
}

#web-image-editor .layer-item.is-active {
  border-color: #a3bffa;
  background: #ebf4ff;
}

#web-image-editor .layer-item.is-hidden .layer-item-label {
  color: #a0aec0;
}

#web-image-editor .layer-drag-handle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 26px;
  color: #cbd5e0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -1px;
  user-select: none;
  line-height: 1;
}

#web-image-editor .layer-vis-btn {
  flex: 0 0 auto;
  align-self: center;
  width: 26px;
  height: 26px;
  min-width: 26px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #718096;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

#web-image-editor .layer-vis-btn svg {
  display: block;
}

#web-image-editor .layer-vis-btn:hover {
  border-color: #e2e8f0;
  background: #f7fafc;
  color: #2d3748;
}

#web-image-editor .layer-item.is-hidden .layer-vis-btn {
  color: #a0aec0;
}

#web-image-editor .layer-item-label {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 5px 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: #2d3748;
  text-align: left;
  cursor: pointer;
}

#web-image-editor .layer-item-label:hover {
  background: rgba(0, 0, 0, 0.03);
}

#web-image-editor .layer-item-kind {
  font-size: 10px;
  font-weight: 500;
  color: #718096;
}

#web-image-editor .layer-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-top: 6px;
  border-top: 1px solid #e2e8f0;
}

#web-image-editor .layer-panel-actions button {
  flex: 1 1 calc(50% - 4px);
  padding: 5px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  font-size: 11px;
  font-weight: 600;
  color: #4a5568;
  cursor: pointer;
  white-space: nowrap;
}

#web-image-editor .layer-panel-actions button:hover:not(:disabled) {
  background: #f7fafc;
  border-color: #a0aec0;
  color: #2d3748;
}

#web-image-editor .layer-panel-actions button:disabled {
  opacity: 0.45;
  cursor: default;
}

#web-image-editor .layer-panel-actions .layer-btn-delete:hover:not(:disabled) {
  background: #fff5f5;
  border-color: #feb2b2;
  color: #c53030;
}

#web-image-editor .canvas-wrap {
  position: relative;
  width: 100%;
  background: #edf2f7;
  border: 2px dashed #cbd5e0;
  border-radius: 14px;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  transition: border-color 0.2s, background 0.2s;
}

#web-image-editor .canvas-wrap.drag-over {
  border-color: #4f46e5;
  background: #ebf4ff;
}

#web-image-editor #main-canvas {
  display: none;
  max-width: 100%;
  height: auto;
  width: auto;
  vertical-align: top;
  border-radius: 6px;
  cursor: crosshair;
}

#web-image-editor .canvas-wrap.has-image #main-canvas {
  outline: 1px dashed rgba(0, 0, 0, 0.25);
  outline-offset: -1px;
}

#web-image-editor .crop-mode-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #2d3748;
  z-index: 15;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  padding: 16px;
  padding-top: 52px;
}

#web-image-editor .crop-mode-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  padding: 10px 20px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

#web-image-editor .crop-mode-close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.7);
}

#web-image-editor .crop-mode-panel {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  max-width: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  margin: 0 auto;
}

#web-image-editor .crop-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

#web-image-editor .crop-ratio-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

#web-image-editor .crop-ratio-label {
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
}

#web-image-editor .crop-ratio-btn {
  padding: 5px 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  color: #4a5568;
  transition: all 0.2s;
}

#web-image-editor .crop-ratio-btn:hover {
  border-color: #4f46e5;
  color: #4f46e5;
}

#web-image-editor .crop-ratio-btn.active {
  background: #4f46e5;
  color: #fff;
  border-color: #4f46e5;
}

#web-image-editor .crop-canvas-area {
  position: relative;
  background: #e2e8f0;
  border-radius: 10px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 14px;
  max-height: 70vh;
}

#web-image-editor .crop-canvas-inner {
  position: relative;
  display: inline-block;
  line-height: 0;
}

#web-image-editor #crop-canvas {
  display: block;
  max-width: 100%;
}

#web-image-editor .crop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

#web-image-editor .crop-region {
  position: absolute;
  border: 2px solid #4f46e5;
  cursor: move;
  pointer-events: auto;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
  container-type: size;
}

#web-image-editor .crop-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

#web-image-editor .crop-grid::before,
#web-image-editor .crop-grid::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.4);
}

#web-image-editor .crop-grid::before {
  top: 33.33%;
  left: 0;
  right: 0;
  height: 1px;
  box-shadow: 0 33.33cqh 0 0 rgba(255, 255, 255, 0.4);
}

#web-image-editor .crop-grid::after {
  left: 33.33%;
  top: 0;
  bottom: 0;
  width: 1px;
  box-shadow: 33.33cqw 0 0 0 rgba(255, 255, 255, 0.4);
}

#web-image-editor .crop-handle {
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  border: 2px solid #4f46e5;
  border-radius: 50%;
  pointer-events: auto;
  z-index: 2;
}

#web-image-editor .crop-handle[data-handle="nw"] { top: -9px; left: -9px; cursor: nw-resize; }
#web-image-editor .crop-handle[data-handle="ne"] { top: -9px; right: -9px; cursor: ne-resize; }
#web-image-editor .crop-handle[data-handle="sw"] { bottom: -9px; left: -9px; cursor: sw-resize; }
#web-image-editor .crop-handle[data-handle="se"] { bottom: -9px; right: -9px; cursor: se-resize; }
#web-image-editor .crop-handle[data-handle="n"] { top: -9px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
#web-image-editor .crop-handle[data-handle="s"] { bottom: -9px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
#web-image-editor .crop-handle[data-handle="e"] { top: 50%; right: -9px; transform: translateY(-50%); cursor: e-resize; }
#web-image-editor .crop-handle[data-handle="w"] { top: 50%; left: -9px; transform: translateY(-50%); cursor: w-resize; }

#web-image-editor .crop-size-info {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
}

#web-image-editor .crop-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

#web-image-editor .crop-exec-btn {
  padding: 12px 28px;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

#web-image-editor .crop-exec-btn:hover {
  background: linear-gradient(135deg, #4338ca, #4f46e5);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

#web-image-editor .crop-cancel-btn {
  padding: 12px 28px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  color: #4a5568;
  transition: all 0.2s;
}

#web-image-editor .crop-cancel-btn:hover {
  background: #f7fafc;
  border-color: #cbd5e0;
}

#web-image-editor .white-canvas-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10050;
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
}

#web-image-editor .white-canvas-box {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  max-width: min(440px, calc(100vw - 32px));
  width: 100%;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  margin: auto;
  flex-shrink: 0;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

#web-image-editor .white-canvas-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 8px;
}

#web-image-editor .white-canvas-desc {
  font-size: 14px;
  color: #4a5568;
  margin: 0 0 16px;
  line-height: 1.55;
}

#web-image-editor .white-canvas-preset-row {
  margin-bottom: 16px;
}

#web-image-editor .white-canvas-preset-btn {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #c7d2fe;
  background: #eef2ff;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #4338ca;
  cursor: pointer;
  text-align: center;
}

#web-image-editor .white-canvas-preset-btn:hover {
  background: #e0e7ff;
  border-color: #818cf8;
}

#web-image-editor .white-canvas-fill-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: #4a5568;
}

#web-image-editor .white-canvas-fill-label {
  font-weight: 600;
}

#web-image-editor .white-canvas-fill-opt {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  cursor: pointer;
}

#web-image-editor .white-canvas-fill-opt input {
  margin: 0;
  cursor: pointer;
}

#web-image-editor .white-canvas-size-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  margin-bottom: 18px;
}

#web-image-editor .white-canvas-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
  flex: 1 1 140px;
}

#web-image-editor .white-canvas-num-input {
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #1a202c;
  max-width: 100%;
}

#web-image-editor .white-canvas-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#web-image-editor .white-canvas-primary {
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

#web-image-editor .white-canvas-primary:hover {
  opacity: 0.94;
}

#web-image-editor .white-canvas-close {
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
  cursor: pointer;
}

#web-image-editor .white-canvas-close:hover {
  background: #f7fafc;
}

#web-image-editor .zoom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

#web-image-editor .zoom-label {
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
}

#web-image-editor .zoom-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: #4a5568;
  transition: all 0.18s;
}

#web-image-editor .zoom-btn:hover {
  background: #f7fafc;
  border-color: #cbd5e0;
  color: #2d3748;
}

#web-image-editor .zoom-value {
  font-size: 13px;
  font-weight: 700;
  color: #4f46e5;
  min-width: 48px;
  text-align: center;
}

#web-image-editor .dl-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

#web-image-editor .dl-format {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

#web-image-editor .dl-size-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #4a5568;
}

#web-image-editor .dl-size-label {
  font-weight: 600;
}

#web-image-editor .dl-size-opt {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

#web-image-editor .dl-size-opt input {
  cursor: pointer;
}

#web-image-editor .text-entry-box {
  position: absolute;
  z-index: 10;
  background: #fff;
  border: 2px solid #4f46e5;
  border-radius: 10px;
  padding: 10px 12px 8px;
  box-shadow: 0 6px 24px rgba(79,70,229,0.2);
  min-width: 220px;
  transform: translateY(-100%);
}

/** キャンバス上に直接重ねる編集（スライドのようなインライン入力・はみ出し抑制） */
#web-image-editor .text-entry-box.text-entry-box--inline-edit {
  transform: none;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  padding: 6px 8px;
  border: 1px dashed rgba(79, 70, 229, 0.55);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.12);
}

#web-image-editor .text-entry-box.text-entry-box--inline-edit #text-entry-field {
  flex: 1 1 auto;
  min-height: 2em;
  resize: none;
  overflow-y: auto;
  border-bottom: none;
  padding: 2px 4px;
}

#web-image-editor .text-entry-box.text-entry-box--inline-edit .text-entry-hint {
  flex: 0 0 auto;
  margin-top: 0;
  font-size: 10px;
}

#web-image-editor #text-entry-field {
  width: 100%;
  box-sizing: border-box;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: inherit;
  color: #1a202c;
  background: transparent;
  padding: 4px 0 6px;
  border-bottom: 1px solid #e2e8f0;
  min-height: 3.25em;
  resize: vertical;
  line-height: 1.35;
}

#web-image-editor .text-entry-hint {
  font-size: 11px;
  color: #a0aec0;
  margin-top: 6px;
  text-align: center;
  line-height: 1.35;
}

#web-image-editor .saved-image-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10050;
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
}

#web-image-editor .saved-image-picker-box {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  max-width: min(90vw, 640px);
  width: 100%;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  margin: auto;
  flex-shrink: 0;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

#web-image-editor .saved-image-picker-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 14px;
}

#web-image-editor .saved-image-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

#web-image-editor .saved-image-picker-item {
  aspect-ratio: 1;
  padding: 4px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  background: #f7fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
}

#web-image-editor .saved-image-picker-item:hover {
  border-color: #4f46e5;
  background: #eef2ff;
}

#web-image-editor .saved-image-picker-item img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
}

#web-image-editor .saved-image-picker-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #64748b;
  font-size: 14px;
  padding: 24px 16px;
  margin: 0;
}

#web-image-editor .saved-image-picker-close {
  display: block;
  width: 100%;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
  cursor: pointer;
}

#web-image-editor .saved-image-picker-close:hover {
  background: #f7fafc;
}

#web-image-editor .drop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  gap: 8px;
}

#web-image-editor .eraser-cursor {
  position: absolute;
  pointer-events: none;
  display: none;
  border-radius: 50%;
  border: 2px solid #333;
  background: rgba(0, 0, 0, 0.06);
  box-sizing: border-box;
  z-index: 5;
}

#web-image-editor .drop-icon {
  font-size: 48px;
  color: #cbd5e0;
  line-height: 1;
  font-weight: 300;
}

#web-image-editor .drop-text {
  text-align: center;
  color: #a0aec0;
  font-size: 16px;
  line-height: 1.8;
  font-weight: 500;
}

#web-image-editor .drop-note {
  font-size: 12px;
  color: #c4cdd6;
}

#web-image-editor .dl-format button,
#web-image-editor .dl-row button {
  padding: 10px 28px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}

#web-image-editor #btn-dl-png {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color: #fff;
  box-shadow: 0 3px 10px rgba(14,165,233,0.35);
}

#web-image-editor #btn-dl-jpeg {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 3px 10px rgba(16,185,129,0.35);
}

#web-image-editor .dl-format button:hover,
#web-image-editor .dl-row button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}

#web-image-editor .dl-format button:active,
#web-image-editor .dl-row button:active {
  transform: translateY(0);
  box-shadow: none;
}

#web-image-editor .guide-section {
  margin-top: 36px;
  background: #f7fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 24px;
}

#web-image-editor .guide-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e2e8f0;
}

#web-image-editor .guide-list {
  padding-left: 20px;
  margin-bottom: 18px;
}

#web-image-editor .guide-list li {
  font-size: 14px;
  color: #4a5568;
  line-height: 1.9;
}

#web-image-editor .guide-list-compact {
  margin-bottom: 12px;
}

#web-image-editor .guide-list-compact li {
  line-height: 1.65;
  margin-bottom: 4px;
}

#web-image-editor .guide-note-title {
  font-size: 14px;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 8px;
}

#web-image-editor .guide-notes ul {
  padding-left: 20px;
}

#web-image-editor .guide-notes li {
  font-size: 13px;
  color: #718096;
  line-height: 1.8;
}

@media (max-width: 900px) {
  #web-image-editor .workspace-row {
    flex-direction: column;
  }

  #web-image-editor .layer-panel {
    flex: 0 0 auto;
    width: 100%;
    max-height: 280px;
  }
}

@media (max-width: 640px) {
  #web-image-editor .toolbar-row {
    flex-direction: column;
    align-items: stretch;
  }

  #web-image-editor .toolbar-col-upload .btn-upload {
    min-width: 0;
  }

  #web-image-editor .action-btns {
    align-items: stretch;
    margin-left: 0;
  }

  #web-image-editor .tool-group {
    flex-wrap: wrap;
  }

  #web-image-editor .dl-row {
    flex-direction: column;
  }

  #web-image-editor .dl-row button {
    width: 100%;
    text-align: center;
  }

  #web-image-editor .app-title {
    font-size: 18px;
  }
}

#web-image-editor h2,
#web-image-editor h3 {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  margin: 0 0 12px;
  box-shadow: none;
}
#web-image-editor h2::before,
#web-image-editor h2::after,
#web-image-editor h3::before,
#web-image-editor h3::after {
  content: none !important;
  display: none !important;
  background: none !important;
  width: auto !important;
  height: auto !important;
}
#web-image-editor .sticky-note {
  background: #fffbeb;
  border-left: 4px solid #f6c90e;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
  color: #78350f;
}
#web-image-editor #count-display {
  font-weight: 700;
  color: #d97706;
}
#web-image-editor #count-display.loading {
  color: #bbb;
}
#web-image-editor .app-lead {
  font-size: 14px;
  color: #718096;
  margin-bottom: 16px;
  line-height: 1.6;
}
#web-image-editor .guide-section h2.guide-title,
#web-image-editor h2.guide-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 10px;
}
#web-image-editor .related-section {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
}
#web-image-editor .related-section h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}
#web-image-editor .related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
#web-image-editor .related-card {
  display: block;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  text-decoration: none;
  color: #2d3748;
  background: #f7fafc;
  font-size: 13px;
  line-height: 1.45;
  transition: background 0.15s ease, border-color 0.15s ease;
}
#web-image-editor .related-card:hover {
  background: #edf2f7;
  border-color: #cbd5e0;
}
