/* ============================================
   花园景观设计工具 - 样式
   ============================================ */

:root {
  --green-dark: #2d6a4f;
  --green-main: #40916c;
  --green-light: #74c69d;
  --green-bg: #d8f3dc;
  --green-lighter: #f0fff4;
  --text-dark: #1b4332;
  --text-body: #2d6a4f;
  --border: #b7e4c7;
  --shadow: rgba(45, 106, 79, 0.15);
  --radius: 12px;
  --font: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ---- 入口页 ---- */
.garden-entry {
  min-height: 100vh;
  font-family: var(--font);
  background: linear-gradient(180deg, #f0fff4 0%, #ffffff 100%);
}

.entry-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: white;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.back-link {
  color: var(--green-main);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.back-link:hover { text-decoration: underline; }

.logo-text {
  font-weight: 700;
  font-size: 16px;
  color: var(--green-dark);
}

.hero-area {
  display: flex;
  align-items: center;
  gap: 60px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 32px;
}

.hero-content {
  flex: 1;
}

.hero-content h1 {
  font-size: 42px;
  font-weight: 700;
  color: var(--green-dark);
  margin: 0 0 20px;
  line-height: 1.2;
}

.hero-desc {
  font-size: 18px;
  line-height: 1.8;
  color: var(--text-body);
  margin: 0 0 32px;
}

.hero-note {
  font-size: 13px;
  color: #74c69d;
  margin-top: 12px;
}

.btn-primary {
  display: inline-block;
  padding: 14px 32px;
  background: linear-gradient(135deg, var(--green-main), var(--green-dark));
  color: white;
  text-decoration: none;
  border-radius: 30px;
  font-weight: 600;
  font-size: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 15px var(--shadow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(45, 106, 79, 0.3);
}

.btn-large {
  padding: 18px 48px;
  font-size: 18px;
}

.hero-gallery {
  flex: 1;
}

.gallery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.gallery-thumb {
  height: 120px;
  border-radius: var(--radius);
  display: flex;
  align-items: flex-end;
  padding: 12px;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s;
}

.gallery-thumb:hover { transform: scale(1.03); }

.gallery-thumb span {
  color: white;
  font-size: 13px;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  position: relative;
  z-index: 1;
}

/* 功能说明 */
.feature-section {
  max-width: 900px;
  margin: 0 auto;
  padding: 60px 32px;
  border-top: 1px solid var(--border);
}

.feature-section h2 {
  text-align: center;
  font-size: 28px;
  color: var(--green-dark);
  margin: 0 0 40px;
}

.feature-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.feature-item {
  display: flex;
  gap: 16px;
  padding: 24px;
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: box-shadow 0.2s;
}

.feature-item:hover {
  box-shadow: 0 4px 20px var(--shadow);
}

.feature-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.feature-text strong {
  display: block;
  font-size: 16px;
  color: var(--green-dark);
  margin-bottom: 6px;
}

.feature-text p {
  font-size: 14px;
  color: #5a7a6a;
  line-height: 1.6;
  margin: 0;
}

/* 底部CTA */
.entry-cta {
  text-align: center;
  padding: 60px 32px 80px;
  background: linear-gradient(180deg, transparent, var(--green-bg));
}

.entry-cta p {
  font-size: 20px;
  color: var(--green-dark);
  margin: 0 0 20px;
  font-weight: 600;
}

/* ============================================
   设计器页面
   ============================================ */
.designer-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  overflow: hidden;
}

/* 顶部工具栏 */
.designer-toolbar {
  height: 56px;
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  flex-shrink: 0;
  z-index: 200;
}

.toolbar-brand {
  font-weight: 700;
  color: var(--green-dark);
  font-size: 15px;
  margin-right: 8px;
  white-space: nowrap;
}

.toolbar-sep {
  width: 1px;
  height: 28px;
  background: var(--border);
  flex-shrink: 0;
}

.toolbar-spacer { flex: 1; }

/* 按钮样式 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-outline {
  background: white;
  border: 1px solid var(--border);
  color: var(--green-main);
}

.btn-outline:hover { background: var(--green-lighter); }

.btn-solid {
  background: var(--green-main);
  color: white;
}

.btn-solid:hover { background: var(--green-dark); }

.btn-danger {
  background: white;
  border: 1px solid #f5c6cb;
  color: #c0392b;
}

.btn-danger:hover { background: #fff5f5; }

.btn-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  background: #e9ecef;
  color: #adb5bd;
  border-color: #dee2e6;
}

/* 主体区域 */
.designer-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* 左侧素材面板 - 加宽到320px，支持5列显示 */
.elements-panel {
  width: 320px;
  background: white;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-tab {
  flex: 1;
  padding: 10px 8px;
  font-size: 12px;
  font-weight: 500;
  color: #74c69d;
  cursor: pointer;
  text-align: center;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-tab.active {
  color: var(--green-dark);
  border-bottom-color: var(--green-main);
}

.panel-tab:hover { color: var(--green-main); }

.elements-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

/* 素材类别标签横排 */
.el-cat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.el-cat-tab {
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--green-dark);
  background: #f0f4f0;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.el-cat-tab:hover {
  background: #e0e8e0;
}

.el-cat-tab.active {
  background: var(--green-main);
  color: white;
}

/* 每个类别的图片行 */
.el-cat-row {
  display: none; /* 默认隐藏，按Tab切换显示 */
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}

.el-cat-row:last-child {
  border-bottom: none;
}

.el-cat-row.active {
  display: flex;
}

.element-thumb {
  width: 56px;
  height: 56px;
  background: var(--green-lighter);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  overflow: hidden;
  padding: 4px;
  box-sizing: border-box;
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* 桌面版每行显示更多（320px面板可容纳5列，60px*5+6px*4=324px） */
@media (min-width: 901px) {
  .element-thumb {
    width: 60px;
    height: 60px;
  }
}

.element-thumb:hover {
  border-color: var(--green-main);
  transform: scale(1.06);
  box-shadow: 0 4px 12px var(--shadow);
}

.element-thumb:active { cursor: grabbing; }

.element-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.elements-empty {
  text-align: center;
  color: #adb5bd;
  font-size: 13px;
  padding: 40px 0;
}

/* 画布区域 */
.canvas-area {
  flex: 1;
  background: #f4f7f5;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.canvas-toolbar {
  height: 44px;
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
  flex-shrink: 0;
}

.bg-select-thumb {
  width: 40px;
  height: 30px;
  border-radius: 6px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s;
  overflow: hidden;
  flex-shrink: 0;
}

.bg-select-thumb:hover { border-color: var(--green-light); }
.bg-select-thumb.active { border-color: var(--green-main); }

.bg-select-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bg-upload-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--green-main);
  cursor: pointer;
  transition: all 0.15s;
}

.bg-upload-btn:hover {
  border-color: var(--green-main);
  background: var(--green-lighter);
}

.canvas-wrapper {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.design-canvas {
  position: relative;
  background: white;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
  border-radius: 4px;
  overflow: visible; /* 改为visible，让素材可以正确显示 */
  /* 固定比例 4:3，由JS动态设置 */
  flex-shrink: 0;
  /* 确保建立正确的层叠上下文 */
  isolation: isolate; /* 强制建立新的层叠上下文，兼容微信浏览器 */
}

  .canvas-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    pointer-events: none;
    border-radius: 4px;
    z-index: 1;
    /* 确保背景图完全覆盖，无空白 */
    min-width: 100%;
    min-height: 100%;
    /* 强制独立渲染层 */
    will-change: transform;
  }

.canvas-bg-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #adb5bd;
  flex-direction: column;
  gap: 12px;
  border: 2px dashed var(--border);
  border-radius: 4px;
  background: var(--green-lighter);
}

/* 素材层容器 - 必须设置定位以便子元素正确绝对定位 */
#canvas-elements {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10; /* 必须高于背景图的 z-index: 1 */
  /* 强制创建新的渲染层，解决微信浏览器层叠问题 */
  isolation: isolate;
  will-change: transform;
}

#canvas-elements > .canvas-element {
  pointer-events: auto;
}

/* 画布上的元素 */
.canvas-element {
  position: absolute;
  cursor: move;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.canvas-element img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.canvas-element.selected {
  box-shadow: 0 0 0 2px var(--green-main);
}

/* QQ浏览器兼容：使用box-shadow代替::after伪元素 */
.canvas-element.selected::before {
  content: '';
  position: absolute;
  inset: -4px;
  border: 1px dashed var(--green-light);
  border-radius: 4px;
  pointer-events: none;
  /* 使用transform避免缩放问题 */
  transform: translate(0, 0);
  /* QQ浏览器兼容 */
  -webkit-transform: translate(0, 0);
}

/* 调整大小手柄 - 默认隐藏，选中时显示 */
.resize-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--green-main);
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  z-index: 100;
  touch-action: none;
  cursor: pointer;
  display: none; /* 默认隐藏 */
}

.canvas-element.selected .resize-handle {
  display: block; /* 选中时才显示 */
}

.resize-handle:hover {
  background: var(--green-light);
  transform: scale(1.2);
}

.resize-handle.nw { top: -6px; left: -6px; cursor: nw-resize; }
.resize-handle.ne { top: -6px; right: -6px; cursor: ne-resize; }
.resize-handle.se { bottom: -6px; right: -6px; cursor: se-resize; }
.resize-handle.sw { bottom: -6px; left: -6px; cursor: sw-resize; }

/* 右侧面板 */
.right-panel {
  width: 200px;
  background: white;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

/* 选中素材时强制显示面板 */
.right-panel.panel-visible {
  display: flex !important;
  visibility: visible !important;
}

.right-panel-section {
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.right-panel-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--green-dark);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.prop-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.prop-label {
  font-size: 12px;
  color: #5a7a6a;
  width: 40px;
  flex-shrink: 0;
}

.prop-input {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.prop-input:focus { border-color: var(--green-main); }

.prop-slider {
  flex: 1;
  accent-color: var(--green-main);
}

.canvas-info {
  font-size: 12px;
  color: #adb5bd;
  line-height: 1.6;
}

/* ============================================
   裁剪模态框
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  box-sizing: border-box;
}

.modal-box {
  background: white;
  border-radius: var(--radius);
  max-width: 900px;
  width: 100%;
  max-height: 95vh;
  overflow: visible;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--green-dark);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f1f3f4;
  cursor: pointer;
  font-size: 18px;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.modal-close:hover { background: #e2e4e3; }

.modal-body {
  padding: 20px;
  overflow: visible;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-footer-note {
  font-size: 12px;
  color: #adb5bd;
}

/* 裁剪区域 */
.crop-area {
  position: relative;
  max-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4f4f4;
  border-radius: 8px;
  overflow: visible;
}

.crop-area img {
  max-width: 100%;
  max-height: 400px;
  display: block;
}

/* Cropper.js 手柄样式优化 */
.cropper-view-box {
  outline: 2px solid #27ae60;
  outline-color: rgba(39, 174, 96, 0.75);
}
.cropper-line {
  background-color: #27ae60;
}
.cropper-point {
  background-color: #27ae60;
  width: 10px;
  height: 10px;
  opacity: 1;
}
/* 只保留四角手柄，隐藏四边中点手柄 */
.cropper-point.point-n,
.cropper-point.point-s,
.cropper-point.point-e,
.cropper-point.point-w {
  display: none !important;
}
.cropper-modal {
  background-color: rgba(0, 0, 0, 0.5);
}
.cropper-center {
  background-color: rgba(39, 174, 96, 0.5);
}

.crop-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
}

/* ============================================
   保存模态框
   ============================================ */
.save-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--green-dark);
}

.form-group input,
.form-group textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus { border-color: var(--green-main); }

.form-group textarea { resize: vertical; min-height: 60px; }

.form-tip {
  font-size: 12px;
  color: #adb5bd;
}

/* ============================================
   提示消息
   ============================================ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--green-dark);
  color: white;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.error { background: #c0392b; }
.toast.success { background: var(--green-main); }

/* ============================================
   后台样式
   ============================================ */
.admin-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
  font-family: var(--font);
}

.admin-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

.admin-header h1 {
  font-size: 22px;
  color: var(--green-dark);
  margin: 0;
  flex: 1;
}

.admin-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  overflow: hidden;
}

.admin-card-header {
  padding: 14px 20px;
  background: var(--green-lighter);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-card-id {
  font-size: 11px;
  color: #adb5bd;
  font-weight: 500;
  flex-shrink: 0;
}

.admin-card-date {
  font-size: 13px;
  color: var(--green-main);
  margin-left: auto;
  font-weight: 500;
}

.admin-card-body {
  padding: 20px;
  display: flex;
  gap: 24px;
}

.admin-card-info {
  flex: 1;
}

.admin-info-row {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
  font-size: 14px;
}

.admin-info-label {
  color: #adb5bd;
  width: 60px;
  flex-shrink: 0;
}

.admin-info-value {
  color: var(--text-dark);
  font-weight: 500;
}

.admin-card-preview {
  width: 280px;
  height: 210px;
  background: #f4f7f5;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  border: 1px solid var(--border);
}

.admin-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-card-actions {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

.admin-empty {
  text-align: center;
  padding: 60px;
  color: #adb5bd;
  font-size: 15px;
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 900px) {
  .hero-area {
    flex-direction: column;
    padding: 40px 24px;
    gap: 40px;
  }

  .feature-list {
    grid-template-columns: 1fr;
  }

  /* ---- 手机工具栏 ---- */
  .designer-toolbar {
    height: auto;
    padding: 6px 8px;
    gap: 6px;
    flex-wrap: wrap;
  }

  .toolbar-brand { font-size: 13px; margin-right: 0; }
  .toolbar-sep { height: 20px; }

  .designer-toolbar .btn {
    padding: 5px 8px;
    font-size: 11px;
  }

  /* 隐藏诊断和清空按钮，手机端保留核心功能 */
  #btn-clear-canvas { display: none; }

  /* ---- 手机端布局 ---- */
  /* 整个设计器页面填满视口，竖向排列：素材面板 → 画布 → 操作栏 */
  .designer-body {
    flex-direction: column;
    /* 不设固定高度，让内容自然撑开并允许页面滚动 */
    height: auto;
    min-height: calc(100dvh - 44px);
  }

  /* 工具栏：精简为一行 */
  .designer-toolbar {
    height: 40px;
    padding: 0 10px;
    gap: 8px;
  }

  .toolbar-brand { font-size: 14px; }
  .toolbar-sep { display: none; }
  .toolbar-spacer { display: none; }

  /* 素材面板：放在顶部，固定高度 200px */
  .elements-panel {
    width: 100%;
    height: 200px;
    flex-shrink: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  /* 类别Tab固定在顶部，横向滚动 */
  .el-cat-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    padding: 2px 4px;
    gap: 3px;
    border-bottom: 1px solid var(--border);
    background: #fafcf9;
    flex-shrink: 0;
  }

  .el-cat-tab {
    flex-shrink: 0;
    padding: 2px 6px;
    font-size: 10px;
    border-radius: 8px;
  }

  .elements-list {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0;
    -webkit-overflow-scrolling: touch;
  }

  .el-cat-row {
    display: none;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-bottom: none;
    max-height: none;
    box-sizing: border-box;
  }

  .el-cat-row.active {
    display: flex;
  }

  .element-thumb {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    padding: 2px;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
  }

  .element-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
  }

  /* 画布区域：自然填充，不限制最大高度 */
  .canvas-area {
    flex-shrink: 0;
    width: 100%;
    overflow: visible;
    display: flex;
    flex-direction: column;
  }

  .canvas-toolbar {
    height: 36px;
    padding: 0 8px;
    font-size: 11px;
    flex-shrink: 0;
    overflow-x: auto;
  }

  /* 画布容器：不设高度，由画布本身的aspect-ratio撑开 */
  .canvas-wrapper {
    width: 100%;
    overflow: visible;
    display: block;
    padding: 0;
    box-sizing: border-box;
    position: relative;
  }

  /* 画布本体：宽度填满，高度由 aspect-ratio 4:3 自动计算 */
  .design-canvas {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    flex-shrink: 0;
    max-width: none;
    isolation: isolate; /* 强制建立新的层叠上下文 */
  }

  /* 右侧属性面板：手机端移到画布下方，默认隐藏，选中素材时显示 */
  .right-panel {
    display: none;
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
  }

  /* 选中素材时显示，嵌在布局流中（画布下方），不浮层 */
  .right-panel.panel-visible {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-height: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }

  /* 手机端隐藏：X/Y/宽高输入行、统计区、提示区 */
  .hide-mobile {
    display: none !important;
  }

  /* 底部操作栏：只留清空按钮 */
  .mobile-actions {
    display: flex !important;
    align-items: center;
    padding: 6px 12px;
    gap: 10px;
    background: white;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
  }




  .admin-card-body {
    flex-direction: column;
  }

  .admin-card-preview {
    width: 100%;
    height: auto;
    aspect-ratio: 4/3;
  }
}
