/* 画布基础 */
#canvasWrapper {
  width: 100%;
  max-width: 900px;
}

#canvas {
  width: 2000px;
  transform-origin: top left;
  box-sizing: border-box;
  padding: 20px;
}

/* 根据容器宽度自动缩放 */
#canvasWrapper {
  overflow: hidden;
}

/* 宋体回退栈 */
.caption {
  font-family: "SimSun", "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: 24px;
  line-height: 1.6;
}

/* 素材库项 */
.material-item {
  cursor: grab;
  transition: all 0.15s;
}
.material-item:active {
  cursor: grabbing;
}
.material-item.dragging {
  opacity: 0.5;
}

/* 画布网格项 */
.canvas-cell {
  position: relative;
  transition: box-shadow 0.15s;
}
.canvas-cell:hover {
  box-shadow: 0 0 0 2px #3b82f6;
}
.canvas-cell.selected {
  box-shadow: 0 0 0 3px #2563eb;
}

/* 图片容器 */
.img-wrap {
  position: relative;
  overflow: hidden;
  background: #f3f4f6;
}
.img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 边框样式 */
.with-border .img-wrap {
  border: var(--border-width, 2px) solid #374151;
}
.with-border .caption {
  border-left: var(--border-width, 2px) solid #374151;
  border-right: var(--border-width, 2px) solid #374151;
  border-bottom: var(--border-width, 2px) solid #374151;
  margin-top: -1px;
}

/* 空位占位符 */
.empty-cell {
  background: repeating-linear-gradient(
    45deg,
    #f9fafb,
    #f9fafb 10px,
    #f3f4f6 10px,
    #f3f4f6 20px
  );
  border: 2px dashed #d1d5db;
}

/* 拖拽占位符 */
.drop-target {
  outline: 2px dashed #3b82f6;
  outline-offset: -2px;
  background: rgba(59, 130, 246, 0.05);
}

/* 裁剪弹层 */
#cropperModal {
  display: none;
}
#cropperModal.active {
  display: flex;
}

/* 导出弹层 */
#exportModal {
  display: none;
}
#exportModal.active {
  display: flex;
}

/* 比例按钮高亮 */
.ratio-btn.active {
  background: #dbeafe;
  border-color: #3b82f6;
  color: #1d4ed8;
}

/* 缩放滑块 */
#zoomSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
}
#zoomSlider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  border: none;
}

/* 响应式微调 */
@media (max-width: 1280px) {
  aside.w-56 { width: 200px; }
  aside.w-64 { width: 220px; }
}
