/* 拼豆图纸生成器 - 手机端优先样式 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f5f5f7;
  color: #333;
  line-height: 1.5;
  padding-bottom: 80px;
}

/* 顶部标题栏 */
.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-left {
  flex: 1;
}

.header-right {
  flex-shrink: 0;
}

.header h1 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}

/* 主布局：手机端上下排列 */
.main-layout {
  display: flex;
  flex-direction: column;
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

.left-panel,
.right-panel {
  width: 100%;
}

/* 桌面端：左右两栏布局 */
@media (min-width: 900px) {
  .main-layout {
    max-width: 1200px;
    flex-direction: row;
    gap: 24px;
    padding: 24px;
    align-items: flex-start;
  }

  .left-panel {
    flex: 0 0 45%;
    max-width: 500px;
    position: sticky;
    top: 50%;
    transform: translateY(-50%);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding-right: 8px;
  }

  .right-panel {
    flex: 1;
    min-width: 0;
  }

  /* 左栏滚动条美化 */
  .left-panel::-webkit-scrollbar {
    width: 4px;
  }
  .left-panel::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
  }
}

/* 卡片样式 */
.card {
  background: white;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .icon {
  font-size: 20px;
}

/* 上传区域 */
.upload-area {
  border: 2px dashed #ddd;
  border-radius: 12px;
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: #fafafa;
}

.upload-area:hover,
.upload-area:active {
  border-color: #667eea;
  background: #f0f2ff;
}

.upload-area .upload-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.upload-area .upload-text {
  font-size: 14px;
  color: #666;
  margin-bottom: 4px;
}

.upload-area .upload-hint {
  font-size: 12px;
  color: #999;
}

.upload-area input[type="file"] {
  display: none;
}

/* 上传区域预览图（上传后） */
.upload-area.has-image {
  padding: 0;
  border-style: solid;
  overflow: hidden;
  position: relative;
}

.upload-area-preview {
  position: relative;
  width: 100%;
  max-height: 200px;
  overflow: hidden;
}

.upload-area-preview img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: contain;
  background: #fff;
}

.upload-area-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
}

.upload-area:hover .upload-area-overlay {
  opacity: 1;
}

.upload-area-overlay span {
  color: #fff;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 16px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}

/* 版本号显示 */
.app-version {
  position: fixed;
  bottom: 4px;
  right: 8px;
  font-size: 10px;
  color: #ccc;
  pointer-events: none;
  z-index: 9999;
}

/* 原图预览 */
.preview-original {
  text-align: center;
}

.preview-original img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  object-fit: contain;
}

.preview-original .change-btn {
  margin-top: 8px;
  background: none;
  border: none;
  color: #667eea;
  font-size: 14px;
  cursor: pointer;
}

/* 表单控件 */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: #333;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

input[type="number"],
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  background: white;
  color: #333;
  -webkit-appearance: none;
  appearance: none;
}

input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 开关样式 */
.switch-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.switch-label {
  font-size: 14px;
  color: #333;
}

/* 背景模式选择器 */
.bg-mode-selector {
  display: inline-flex;
  background: #f0f0f0;
  border-radius: 8px;
  padding: 2px;
}

.bg-mode-btn {
  padding: 5px 14px;
  font-size: 13px;
  border: none;
  background: transparent;
  color: #666;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}

.bg-mode-btn.active {
  background: white;
  color: #667eea;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.switch {
  position: relative;
  width: 44px;
  height: 26px;
  background: #ddd;
  border-radius: 13px;
  cursor: pointer;
  transition: background 0.3s;
}

.switch.active {
  background: #667eea;
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.switch.active::after {
  transform: translateX(18px);
}

/* 滑块样式 */
.slider-group {
  margin-bottom: 16px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.slider-label {
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

.slider-value {
  font-size: 14px;
  color: #667eea;
  font-weight: 600;
}

input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: #e0e0e0;
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  background: #667eea;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
}

/* 生成按钮 */
.generate-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
}

.generate-btn:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.generate-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.6;
}

/* 加载动画 */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 结果区域 */
.result-section {
  display: none;
}

.result-section.show {
  display: block;
}

.result-preview {
  text-align: center;
  background: #fafafa;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  overflow-x: auto;
}

.result-preview canvas {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* 统计信息 */
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.stat-item {
  flex: 1;
  min-width: 80px;
  background: #f5f5f7;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: #667eea;
}

.stat-label {
  font-size: 11px;
  color: #999;
  margin-top: 2px;
}

/* 颜色列表 */
.color-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #eee;
  border-radius: 8px;
}

.color-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
}

.color-item:last-child {
  border-bottom: none;
}

.color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  margin-right: 10px;
  border: 1px solid #ddd;
  flex-shrink: 0;
}

.color-code {
  font-weight: 500;
  color: #333;
  flex: 1;
}

.color-count {
  color: #999;
  font-size: 12px;
}

/* 编辑颜色面板 */
.edit-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.edit-color-item {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid #ddd;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.edit-color-item:hover {
  transform: scale(1.1);
}

.edit-color-item.selected {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.edit-color-item .edit-color-code {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #999;
  white-space: nowrap;
}

.btn-secondary {
  background: #f0f0f0;
  color: #333;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:active {
  background: #e0e0e0;
}

/* 选中格子高亮 */
.canvas-highlight {
  position: absolute;
  pointer-events: none;
  border: 2px solid #ff3b30;
  box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.3);
  z-index: 10;
}

/* 预览图可点击放大的提示 */
.result-preview canvas {
  cursor: zoom-in;
}

/* ========== 裁切弹窗 ========== */
.crop-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #ffffff;
  z-index: 1000;
  display: none;
  flex-direction: column;
}

.crop-modal.active {
  display: flex;
}

.crop-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: #f8f8f8;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
  gap: 12px;
}

.crop-close,
.crop-confirm {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 6px;
}

.crop-close {
  color: #666;
}

.crop-confirm {
  color: white;
  background: #667eea;
  font-weight: 500;
}

.crop-confirm:active {
  background: #5568d3;
}

.crop-title {
  flex: 1;
  font-size: 16px;
  font-weight: 500;
  color: #333;
  text-align: center;
}

.crop-canvas-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  background: #fafafa;
}

#cropCanvas {
  max-width: 100%;
  max-height: 100%;
  user-select: none;
  -webkit-user-drag: none;
}

/* 裁切选框 */
.crop-box {
  position: absolute;
  border: 2px solid #fff;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
  cursor: move;
  box-sizing: border-box;
}

.crop-box::before,
.crop-box::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.5);
}

/* 九宫格辅助线 - 横 */
.crop-box::before {
  left: 33.33%;
  right: 33.33%;
  top: 0;
  bottom: 0;
  border-left: 1px solid rgba(255,255,255,0.5);
  border-right: 1px solid rgba(255,255,255,0.5);
  background: transparent;
}

/* 九宫格辅助线 - 竖 */
.crop-box::after {
  top: 33.33%;
  bottom: 33.33%;
  left: 0;
  right: 0;
  border-top: 1px solid rgba(255,255,255,0.5);
  border-bottom: 1px solid rgba(255,255,255,0.5);
  background: transparent;
}

/* 四角手柄 */
.crop-handle {
  position: absolute;
  width: 24px;
  height: 24px;
  z-index: 10;
}

.crop-handle::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: white;
  border: 2px solid #667eea;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.crop-handle-tl { top: -12px; left: -12px; cursor: nwse-resize; }
.crop-handle-tr { top: -12px; right: -12px; cursor: nesw-resize; }
.crop-handle-bl { bottom: -12px; left: -12px; cursor: nesw-resize; }
.crop-handle-br { bottom: -12px; right: -12px; cursor: nwse-resize; }

.crop-footer {
  flex-shrink: 0;
  padding: 10px 12px;
  background: #f8f8f8;
  border-top: 1px solid #eee;
}

.crop-info {
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
  text-align: center;
}

.crop-ratio-switch {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.crop-ratio-btn {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 12px;
  background: #fff;
  color: #666;
  border: 1px solid #ddd;
  cursor: pointer;
  transition: all 0.15s;
}

.crop-ratio-btn:active {
  transform: scale(0.95);
}

.crop-ratio-btn.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

/* ========== 授权激活 ========== */
.license-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.2);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
}

.license-status {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}

.license-status.active {
  color: #a7f3d0;
}

.license-btn {
  background: white;
  color: #667eea;
  border: none;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.license-btn:active {
  transform: scale(0.95);
}

/* 激活弹窗 */
.license-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.license-modal.active {
  display: flex;
}

.license-modal-content {
  background: white;
  border-radius: 20px;
  padding: 24px 20px 20px;
  width: 100%;
  max-width: 380px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.license-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 18px;
  color: #999;
  cursor: pointer;
  padding: 4px 8px;
}

.license-modal-title {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4px;
  color: #333;
}

.license-modal-subtitle {
  font-size: 13px;
  color: #999;
  text-align: center;
  margin-bottom: 20px;
}

/* 已激活状态 */
.license-activated {
  text-align: center;
  padding: 16px 0 20px;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-radius: 12px;
  margin-bottom: 16px;
}

.license-activated-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.license-activated-plan {
  font-size: 18px;
  font-weight: 700;
  color: #16a34a;
  margin-bottom: 4px;
}

.license-activated-expire {
  font-size: 13px;
  color: #666;
  margin-bottom: 2px;
}

.license-activated-days {
  font-size: 12px;
  color: #16a34a;
  font-weight: 500;
}

/* 输入框 */
.license-input-wrap {
  margin-bottom: 16px;
}

.license-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 16px;
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.license-input:focus {
  outline: none;
  border-color: #667eea;
}

.license-error {
  color: #ef4444;
  font-size: 13px;
  text-align: center;
  margin-top: 8px;
  min-height: 18px;
}

.license-activate-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
}

.license-activate-btn:active {
  transform: scale(0.98);
}

/* 套餐说明 */
.license-plans {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
}

.license-plans-title {
  font-size: 13px;
  font-weight: 600;
  color: #666;
  margin-bottom: 8px;
}

.license-plan-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
  color: #555;
}

.license-plan-item.highlight {
  color: #667eea;
  font-weight: 600;
}

.license-plan-item .plan-price {
  font-weight: 600;
  color: #ff6b35;
}

.license-contact {
  text-align: center;
  font-size: 13px;
  color: #666;
  padding-top: 12px;
  border-top: 1px solid #eee;
}

.license-contact b {
  color: #667eea;
  user-select: all;
}

/* ========== 精细度下拉选择器 ========== */
.pixel-selector {
  position: relative;
}

.pixel-selector-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.pixel-selector-btn:hover {
  border-color: #667eea;
}

.pixel-selector-btn:active {
  transform: scale(0.99);
}

.pixel-selector.open .pixel-selector-btn {
  border-color: #667eea;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.pixel-current {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #333;
}

.pixel-dot {
  font-size: 18px;
  color: #667eea;
}

.pixel-arrow {
  font-size: 12px;
  color: #999;
  transition: transform 0.2s;
}

.pixel-selector.open .pixel-arrow {
  transform: rotate(180deg);
}

.pixel-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 2px solid #667eea;
  border-top: none;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 100;
  display: none;
  overflow: hidden;
}

.pixel-selector.open .pixel-dropdown {
  display: block;
}

.pixel-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.pixel-option:hover {
  background: #f5f7ff;
}

.pixel-option:active {
  background: #e8edff;
}

.pixel-option.active {
  background: linear-gradient(135deg, #f0f4ff 0%, #e8edff 100%);
}

.pixel-option-icon {
  font-size: 20px;
  color: #667eea;
  width: 24px;
  text-align: center;
}

.pixel-option-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.pixel-option.active .pixel-option-name {
  color: #667eea;
}

.pixel-option-desc {
  font-size: 12px;
  color: #999;
}

/* 行内小开关（放在标题右边） */
.switch-inline {
  float: right;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: normal;
}

.switch-label-sm {
  font-size: 12px;
  color: #999;
}

.switch.small {
  width: 34px;
  height: 20px;
  min-height: 20px;
}

.switch.small::after {
  width: 16px;
  height: 16px;
  top: 2px;
  left: 2px;
}

.switch.small.active::after {
  transform: translateX(14px);
}

/* 高级设置折叠 */
.advanced-toggle {
  cursor: pointer;
  font-size: 13px;
  color: #999;
  font-weight: normal;
  user-select: none;
}

.advanced-toggle:hover {
  color: #667eea;
}

.advanced-panel {
  margin-top: 8px;
}

/* ========== 大图预览弹窗 ========== */
.zoom-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #ffffff;
  z-index: 1000;
  display: none;
  flex-direction: column;
}

.zoom-modal.active {
  display: flex;
}

.zoom-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: #f8f8f8;
  color: #333;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
  gap: 12px;
}

.zoom-close {
  background: none;
  border: none;
  color: #333;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}

.zoom-title {
  flex: 1;
  font-size: 16px;
  font-weight: 500;
}

.zoom-info {
  font-size: 14px;
  color: #666;
}

.zoom-canvas-wrap {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

#zoomCanvas {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  transform-origin: 0 0;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
}

#zoomHighlightCanvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  transform-origin: 0 0;
  will-change: transform;
  opacity: 0.8;
  animation: highlightBlink 1s ease-in-out infinite;
}

@keyframes highlightBlink {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* 选色弹层 */
.zoom-color-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 16px 16px 0 0;
  padding: 10px 12px 12px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  z-index: 1001;
  max-height: 45vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
}

.zoom-color-panel.active {
  transform: translateY(0);
}

/* 模式切换 */
.zoom-mode-tabs {
  display: flex;
  background: #f0f0f0;
  border-radius: 8px;
  padding: 2px;
  margin-bottom: 6px;
}

.zoom-mode-tab {
  flex: 1;
  text-align: center;
  padding: 6px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  color: #666;
  transition: all 0.2s;
}

.zoom-mode-tab.active {
  background: white;
  color: #333;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.zoom-color-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  text-align: center;
  color: #333;
}

.zoom-batch-hint {
  font-size: 12px;
  color: #ff6b35;
  text-align: center;
  margin-bottom: 4px;
  padding: 4px;
  background: #fff5f0;
  border-radius: 4px;
}

/* 字母分栏 */
.zoom-series-bar {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 4px;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
}

.zoom-series-bar::-webkit-scrollbar {
  display: none;
}

.series-chip {
  flex-shrink: 0;
  padding: 5px 12px;
  font-size: 13px;
  border-radius: 16px;
  background: #f0f0f0;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
}

.series-chip:active {
  transform: scale(0.95);
}

.series-chip.active {
  background: #667eea;
  color: white;
  font-weight: 500;
}

.series-chip .series-count {
  font-size: 10px;
  opacity: 0.7;
  margin-left: 2px;
}

/* 颜色网格 */
.zoom-colors-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 4px;
  margin-bottom: 6px;
}

.zoom-color-item {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 3px solid #e0e0e0;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 2px;
}

.zoom-color-item:active {
  transform: scale(0.92);
}

.zoom-color-item.selected {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.4);
  transform: scale(1.05);
}

.zoom-color-item.batch-src {
  border-color: #ff6b35;
  box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.5);
  transform: scale(1.08);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(255, 107, 53, 0.7); }
}

.zoom-color-item .z-code {
  font-size: 10px;
  color: rgba(0,0,0,0.8);
  background: rgba(255,255,255,0.9);
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1.3;
  white-space: nowrap;
  font-weight: 500;
}

.zoom-panel-actions {
  flex-shrink: 0;
}

.zoom-cancel-btn {
  width: 100%;
  padding: 12px;
  background: #f0f0f0;
  color: #333;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
}

.zoom-cancel-btn:active {
  background: #e0e0e0;
}

/* 大图预览内的撤销按钮 */
.zoom-undo-btn {
  margin-left: 12px;
  padding: 6px 14px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.zoom-undo-btn:active {
  background: #fde68a;
}

/* 清除色块按钮 */
.zoom-clear-btn {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  background: #fef2f2;
  color: #dc2626;
  border: 1px dashed #fca5a5;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}
.zoom-clear-btn:active {
  background: #fee2e2;
}

/* 格子选中高亮（大图模式） */
.zoom-cell-highlight {
  position: absolute;
  pointer-events: none;
  z-index: 10;
  border-radius: 2px;
}

/* 单格改色：紫色 */
.zoom-highlight-single {
  border: 3px solid #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.4),
              0 0 10px rgba(102, 126, 234, 0.6);
}

/* 批量改色：橙色脉冲 */
.zoom-highlight-batch {
  border: 3px solid #ff6b35;
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.5),
              0 0 12px rgba(255, 107, 53, 0.7);
  animation: batchPulse 1s ease-in-out infinite;
}

@keyframes batchPulse {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.5),
                0 0 12px rgba(255, 107, 53, 0.7);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(255, 107, 53, 0.6),
                0 0 20px rgba(255, 107, 53, 0.8);
  }
}

/* 底部操作栏 */
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  padding: 12px 16px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  display: none;
  z-index: 100;
}

.bottom-bar.show {
  display: block;
}

.export-btn {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  display: block;
  padding: 14px;
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.export-btn:active {
  transform: scale(0.98);
}

/* 导出弹窗（移动端长按保存用） */
.export-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 300;
  display: none;
  flex-direction: column;
}

.export-modal.active {
  display: flex;
}

.export-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  color: white;
  flex-shrink: 0;
}

.export-modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.export-modal-title {
  font-size: 16px;
  font-weight: 500;
}

.export-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 16px 24px;
  text-align: center;
}

.export-tip {
  color: white;
  font-size: 14px;
  margin-bottom: 12px;
}

.export-tip-sub {
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  margin: 12px 0 8px;
}

.export-img-wrap {
  background: white;
  border-radius: 8px;
  padding: 8px;
  display: inline-block;
  max-width: 100%;
  overflow: auto;
}

.export-img-wrap img {
  max-width: 100%;
  height: auto;
  display: block;
}

.export-download-btn {
  margin-top: 8px;
  padding: 10px 24px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.export-download-btn:active {
  opacity: 0.8;
}

/* 提示文字 */
.tip {
  font-size: 12px;
  color: #999;
  margin-top: 8px;
  line-height: 1.4;
}

/* 智能推荐尺寸按钮 */
.auto-size-btn {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  border: 1px solid #7dd3fc;
  border-radius: 8px;
  color: #0284c7;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.auto-size-btn:active {
  transform: scale(0.98);
  background: #e0f2fe;
}

/* 选项卡 */
.tabs {
  display: flex;
  background: #f0f0f0;
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  padding: 8px;
  text-align: center;
  font-size: 13px;
  color: #666;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
}

.tab.active {
  background: white;
  color: #333;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 平板适配 */
@media (min-width: 768px) {
  .main-layout {
    max-width: 700px;
  }

  .header h1 {
    font-size: 24px;
  }

  .card {
    padding: 24px;
    margin-bottom: 20px;
  }

  /* 平板及以上隐藏移动端预览 */
  .mobile-preview {
    display: none !important;
  }
}

/* ========== 移动端吸顶预览 ========== */
.mobile-preview {
  position: sticky;
  top: 44px;
  z-index: 90;
  background: #fff;
  border-bottom: 1px solid #eee;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Tab 切换栏 */
.mobile-preview-tabs {
  display: flex;
  position: relative;
  background: #f5f5f7;
  padding: 6px;
  margin: 0;
}

.mobile-tab {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  border-radius: 6px;
  position: relative;
  z-index: 1;
  transition: color 0.3s;
  -webkit-tap-highlight-color: transparent;
}

.mobile-tab.active {
  color: #667eea;
  font-weight: 500;
}

.mobile-tab-indicator {
  position: absolute;
  top: 6px;
  bottom: 6px;
  width: 50%;
  background: white;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s ease;
  z-index: 0;
}

.mobile-tab-indicator.slide-right {
  transform: translateX(100%);
}

/* 滑动容器 */
.mobile-preview-slider {
  display: flex;
  overflow-x: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  height: 40vh;
  max-height: 280px;
  min-height: 200px;
}

.mobile-preview-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
}

.mobile-preview-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.mobile-preview-content img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

.mobile-preview-content canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

/* 预览操作栏 */
.mobile-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  background: #f8f9fa;
  border-radius: 10px;
  margin: 6px 8px 0;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.mobile-tool-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: white;
  color: #667eea;
  border: 1px solid #e0e4ff;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.mobile-tool-btn:active {
  background: #f0f2ff;
  transform: scale(0.97);
}

.mobile-tool-btn .tool-icon {
  font-size: 13px;
}

.mobile-tool-divider {
  width: 1px;
  height: 20px;
  background: #e0e0e0;
  flex-shrink: 0;
}

/* 移动端背景切换 */
.mobile-bg-switcher {
  display: flex;
  background: white;
  border-radius: 6px;
  border: 1px solid #e0e4ff;
  overflow: hidden;
  flex-shrink: 0;
}

.mobile-bg-btn {
  padding: 4px 8px;
  font-size: 11px;
  border: none;
  background: transparent;
  color: #666;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mobile-bg-btn.active {
  background: #667eea;
  color: white;
}

.mobile-tool-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #555;
  flex-shrink: 0;
}

/* 统计信息 */
.mobile-preview-stats {
  display: flex;
  justify-content: space-around;
  padding: 8px 16px;
  border-top: 1px solid #f0f0f0;
  background: #fafafa;
}

.mobile-preview-stats .stat-item {
  text-align: center;
}

.mobile-preview-stats .stat-value {
  font-size: 16px;
  font-weight: 600;
  color: #667eea;
}

.mobile-preview-stats .stat-label {
  font-size: 11px;
  color: #999;
  margin-top: 2px;
}

/* 移动端：桌面端元素隐藏 */
@media (max-width: 767px) {
  .desktop-only {
    display: none !important;
  }

  body {
    padding-bottom: 80px;
  }

  /* 移动端主布局调整 */
  .main-layout {
    padding: 12px;
  }

  .left-panel {
    margin-bottom: 0;
  }

  /* 上传后 body 加 padding-top 避开吸顶预览 */
  body.has-preview .main-layout {
    padding-top: 12px;
  }
}

/* ========== 模式切换 ========== */
.mode-switcher {
  display: flex;
  background: white;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 44px;
  z-index: 95;
}

.mode-tab {
  flex: 1;
  text-align: center;
  padding: 12px 0;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  font-weight: 500;
}

.mode-tab.active {
  color: #667eea;
  border-bottom-color: #667eea;
}

.mode-tab:active {
  background: #f5f5f7;
}

/* ========== 拍立得画布 ========== */
.polaroid-canvas-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 12px;
  min-height: 200px;
}

#polaroidCanvas {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
  cursor: grab;
}

#polaroidCanvas:active {
  cursor: grabbing;
}

/* ========== 尺寸选择 ========== */
.size-options {
  display: flex;
  gap: 8px;
}

.size-option {
  flex: 1;
  padding: 12px 8px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}

.size-option:active {
  transform: scale(0.97);
}

.size-option.active {
  border-color: #667eea;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8edff 100%);
}

.size-name {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  margin-bottom: 2px;
}

.size-option.active .size-name {
  color: #667eea;
}

.size-desc {
  font-size: 11px;
  color: #999;
}

/* ========== 布局选择 ========== */
.layout-options {
  display: flex;
  gap: 8px;
}

.layout-option {
  flex: 1;
  padding: 12px 6px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}

.layout-option:active {
  transform: scale(0.97);
}

.layout-option.active {
  border-color: #667eea;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8edff 100%);
}

.layout-icon {
  font-size: 20px;
  margin-bottom: 4px;
}

.layout-name {
  font-size: 12px;
  font-weight: 600;
  color: #333;
  margin-bottom: 2px;
}

.layout-option.active .layout-name {
  color: #667eea;
}

.layout-desc {
  font-size: 10px;
  color: #999;
}

/* ========== 调色板行 ========== */
.color-palette-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 4px 0;
}

.palette-color {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid #e0e0e0;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.palette-color:active {
  transform: scale(0.9);
}

.palette-color.active {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
  transform: scale(1.1);
}

/* ========== 配色方案选项 ========== */
.scheme-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.scheme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
}

.scheme-option:active {
  transform: scale(0.98);
}

.scheme-option.active {
  border-color: #667eea;
  background: #f5f7ff;
}

.scheme-preview {
  width: 36px;
  height: 48px;
  border-radius: 4px;
  flex-shrink: 0;
}

.scheme-info {
  flex: 1;
  min-width: 0;
}

.scheme-name {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  margin-bottom: 2px;
}

.scheme-desc {
  font-size: 11px;
  color: #999;
}

/* ========== 素材库 ========== */
.sticker-tabs {
  display: flex;
  background: #f0f0f0;
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 10px;
}

.sticker-tab {
  flex: 1;
  text-align: center;
  padding: 6px;
  font-size: 13px;
  color: #666;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.sticker-tab.active {
  background: white;
  color: #333;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.sticker-item {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f7;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  transition: all 0.15s;
  user-select: none;
}

.sticker-item:active {
  background: #667eea;
  color: white;
  transform: scale(0.92);
}

.sticker-item canvas {
  max-width: 100%;
  max-height: 100%;
}

/* ========== 桌面端适配 ========== */
@media (min-width: 992px) {
  .mode-switcher {
    top: 56px;
  }

  .sticker-grid {
    grid-template-columns: repeat(10, 1fr);
  }
}

/* ========== 图纸缩放 ========== */
.scaler-info {
  display: flex;
  gap: 16px;
}

.scaler-info-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  background: #f5f7ff;
  border-radius: 8px;
  text-align: center;
}

.scaler-info-label {
  font-size: 12px;
  color: #999;
}

.scaler-info-value {
  font-size: 16px;
  font-weight: 600;
  color: #667eea;
}

/* 手动调整格子数 */
.grid-adjust-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.grid-adjust-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.grid-adjust-item label {
  font-size: 12px;
  color: #666;
  width: 60px;
  flex-shrink: 0;
}

.grid-adjust-input {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
}

.grid-adjust-input input {
  flex: 1;
  height: 32px;
  text-align: center;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  min-width: 0;
  width: 100%;
}

.grid-adjust-btn {
  width: 30px;
  height: 30px;
  border: 1px solid #ddd;
  background: #f5f5f5;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-appearance: none;
  appearance: none;
  padding: 0;
}

.grid-adjust-btn:active {
  background: #e0e0e0;
}

/* 缩放滑块 */
.scale-slider-wrap {
  padding: 8px 0;
}

.scale-percent-display {
  text-align: center;
  font-size: 32px;
  font-weight: 700;
  color: #667eea;
  margin-bottom: 12px;
}

.scale-slider-wrap input[type="range"] {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, #667eea 0%, #764ba2 100%);
  border-radius: 4px;
  outline: none;
}

.scale-slider-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #667eea;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.scale-slider-wrap input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #667eea;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  color: #999;
}

/* 色卡列表 */
.scaler-palette-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scaler-palette-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #f5f7ff;
  border-radius: 20px;
  font-size: 12px;
}

.scaler-palette-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #ddd;
}

.scaler-palette-code {
  font-weight: 600;
  color: #333;
}

/* 缩放预览画布 */
.scaler-canvas-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 200px;
  max-height: 70vh;
  overflow: auto;
  padding: 10px;
  background: #f5f5f5;
  border-radius: 4px;
  position: relative;
}

.scaler-canvas-wrap::after {
  content: '可滑动查看完整图纸';
  position: absolute;
  bottom: 4px;
  right: 8px;
  font-size: 10px;
  color: #999;
  pointer-events: none;
}

.scaler-canvas-wrap canvas {
  max-width: none;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: #fff;
}

/* 预览标题上的尺寸角标 */
.preview-size-badge {
  font-size: 12px;
  font-weight: normal;
  color: #666;
  background: #f0f0f0;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
}

/* 预览统计信息 */
.preview-stats {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: #f9f9f9;
  border-top: 1px solid #eee;
}

.preview-stat-item {
  flex: 1;
  text-align: center;
}

.preview-stat-label {
  display: block;
  font-size: 11px;
  color: #999;
  margin-bottom: 2px;
}

.preview-stat-value {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

/* ========== 置信度状态栏 ========== */
.confidence-status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #f0f4ff 0%, #f5f0ff 100%);
  border-radius: 10px;
  margin-bottom: 8px;
}

.confidence-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.confidence-stat-label {
  font-size: 11px;
  color: #999;
}

.confidence-stat-value {
  font-size: 18px;
  font-weight: 700;
}

.confidence-stat-value.confidence-high {
  color: #10b981;
}

.confidence-stat-value.confidence-low {
  color: #ff6b35;
}

.confidence-stat-value.confidence-inferred {
  color: #8b5cf6;
}

.confidence-divider {
  width: 1px;
  height: 28px;
  background: rgba(0, 0, 0, 0.08);
}

/* 筛选开关行 */
.confidence-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px;
  margin-bottom: 8px;
}

.filter-label {
  font-size: 13px;
  color: #666;
}

/* 置信度图例 */
.confidence-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 10px;
  background: #fafafa;
  border-radius: 8px;
  margin-bottom: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-swatch {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid #ddd;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.legend-high {
  background: #10b981;
  border-color: #059669;
}

.legend-medium {
  background: #fbbf24;
  border-color: #f59e0b;
}

.legend-triangle {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-top: 8px solid rgba(255, 255, 255, 0.85);
  border-right: 8px solid transparent;
}

.legend-low {
  background: #ff6b35;
  border-color: #ea580c;
  border-style: dashed;
  border-width: 2px;
}

.legend-unknown {
  background: #cccccc;
  border-color: #999;
  color: white;
  font-size: 10px;
  font-weight: bold;
}

.legend-inferred {
  background: repeating-linear-gradient(
    45deg,
    #8b5cf6,
    #8b5cf6 2px,
    #c4b5fd 2px,
    #c4b5fd 4px
  );
  border-color: #7c3aed;
}

.legend-text {
  font-size: 11px;
  color: #666;
}

/* 候选色号 tooltip */
.candidate-tooltip {
  position: fixed;
  z-index: 9999;
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 10px;
  min-width: 160px;
  max-width: 220px;
  border: 1px solid #e0e0e0;
}

.candidate-title {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #eee;
}

.candidate-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  border-radius: 6px;
}

.candidate-item:hover {
  background: #f5f7ff;
}

.candidate-color {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid #ddd;
  flex-shrink: 0;
}

.candidate-info {
  flex: 1;
  min-width: 0;
}

.candidate-code {
  font-size: 13px;
  font-weight: 600;
  color: #333;
}

.candidate-name {
  font-size: 11px;
  color: #999;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.candidate-hint {
  font-size: 11px;
  color: #bbb;
  text-align: center;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #f0f0f0;
}
