.tool-fullwidth {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Tool shell */
.image-tool {
    max-width: 100%;
    margin: 0 auto;
}

.image-tool.editor-section,
.editor-section.image-tool {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.image-tool .card:not(.result-card) {
    border: 1px solid var(--color-border, #e5e7eb);
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.06));
    border-radius: var(--radius, 12px);
    background: var(--color-surface, #fff);
}

.image-tool .card-body {
    padding: 1.25rem 1.35rem;
}

.image-tool .card-title {
    color: var(--color-text, #1f2937);
    font-weight: 700;
    font-size: 1.05rem;
}

.image-tool .form-control,
.image-tool .form-select,
.image-tool .select-input,
.image-tool textarea {
    border-radius: 8px;
    border: 1px solid var(--color-border, #e5e7eb);
}

.image-tool .form-control:focus,
.image-tool .form-select:focus,
.image-tool textarea:focus {
    border-color: var(--color-primary, #0d9488);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.image-tool .btn-primary {
    background: var(--color-primary, #0d9488);
    border-color: var(--color-primary, #0d9488);
}

.image-tool .btn-primary:hover {
    background: var(--color-primary-hover, #0f766e);
    border-color: var(--color-primary-hover, #0f766e);
}

.image-tool .alert {
    border-radius: 10px;
}

[data-theme="dark"] .image-tool .card:not(.result-card) {
    background: var(--color-surface, #1f2937);
    border-color: var(--color-border, #374151);
}

[data-theme="dark"] .image-tool .card-title,
[data-theme="dark"] .image-tool .form-label,
[data-theme="dark"] .image-tool {
    color: var(--color-text, #f9fafb);
}

[data-theme="dark"] .image-tool .text-muted,
[data-theme="dark"] .image-tool .form-text {
    color: var(--color-text-secondary, #9ca3af) !important;
}

[data-theme="dark"] .image-tool .form-control,
[data-theme="dark"] .image-tool .form-select,
[data-theme="dark"] .image-tool textarea {
    background: #111827;
    color: var(--color-text, #f9fafb);
    border-color: var(--color-border, #374151);
}

/* --- tool: nine-grid-cut-image --- */
/* 九宫格切图 - 内联样式 */
.tool-nine-grid-cutter .ng-viewport-wrapper {
  background:
    linear-gradient(45deg, #f0f0f0 25%, transparent 25%) 0 0/20px 20px,
    linear-gradient(-45deg, #f0f0f0 25%, transparent 25%) 0 0/20px 20px,
    linear-gradient(45deg, transparent 75%, #f0f0f0 75%) 0 0/20px 20px,
    linear-gradient(-45deg, transparent 75%, #f0f0f0 75%) 0 0/20px 20px;
  padding: 10px;
  border-radius: 10px;
}

.tool-nine-grid-cutter .ng-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1; /* 固定正方形 */
  background-color: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  user-select: none;
  touch-action: none;
  max-height: 60vh;
  cursor: grab;
}

.tool-nine-grid-cutter .ng-viewport.dragging { cursor: grabbing; }

.tool-nine-grid-cutter #ngImage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center center;
  will-change: transform;
  pointer-events: none;
  max-width: none;
}

.tool-nine-grid-cutter .ng-guides {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(#00000026, #00000026), /* 轻蒙层 */
    linear-gradient(to right, transparent 33.333%, #ffffff99 33.333%, #ffffff99 66.666%, transparent 66.666%),
    linear-gradient(to bottom, transparent 33.333%, #ffffff99 33.333%, #ffffff99 66.666%, transparent 66.666%);
  background-size: 100% 100%, 100% 1px, 1px 100%;
  background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.6);
}

.tool-nine-grid-cutter .btn-primary { background: #6c63ff; border: none; }
.tool-nine-grid-cutter .btn-primary:hover { background: #2574e6; }
.tool-nine-grid-cutter .btn-outline-primary { border-color: #6c63ff; color: #6c63ff; }
.tool-nine-grid-cutter .btn-outline-primary:hover { background: #6c63ff; color: #fff; }
.tool-nine-grid-cutter .form-range:focus { box-shadow: 0 0 0 0.2rem rgba(108, 99, 255, 0.25); }

/* 预览卡片 */
.tool-nine-grid-cutter .tile-card { border: 1px solid #e9ecef; border-radius: 8px; overflow: hidden; }
.tool-nine-grid-cutter .tile-card .tile-canvas { display: block; width: 100%; height: auto; }
.tool-nine-grid-cutter .tile-card .tile-actions { padding: .5rem; text-align: center; background-color: #f8f9fa; }
