  * { margin:0; padding:0; box-sizing:border-box; }
  body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f5f5f5; color: #333; min-height: 100vh;
  }
  .header {
    background: linear-gradient(135deg, #FFD93D, #FFC107);
    color: #333; padding: 14px 20px; text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  }
  .header h1 { font-size: 20px; font-weight: 800; }
  .header p { font-size: 12px; opacity: 0.8; margin-top: 2px; }
  .container {
    max-width: 1500px; margin: 16px auto; padding: 0 16px;
    display: grid; grid-template-columns: 350px 1fr; gap: 16px;
  }
  .panel {
    background: #fff; border-radius: 12px; padding: 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  }
  .panel-title {
    font-size: 15px; font-weight: 700; margin-bottom: 14px;
    padding-bottom: 8px; border-bottom: 2px solid #FFD93D;
    display: inline-block;
  }
  .upload-area {
    position: relative; border: 2px dashed #ddd; border-radius: 10px; padding: 28px 16px;
    text-align: center; cursor: pointer; transition: all .3s; background: #fafafa; overflow: hidden;
  }
  .upload-area:hover, .upload-area.dragover { border-color: #FFC107; background: #FFFDE7; }
  .upload-area .icon { font-size: 36px; margin-bottom: 6px; }
  .upload-area p { font-size: 12px; color: #888; }
  .upload-area input[type="file"] {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0; cursor: pointer; z-index: 2;
  }
  .preview-img { margin-top: 10px; text-align: center; }
  .preview-img img { max-width: 100%; max-height: 140px; border-radius: 6px; border: 1px solid #eee; }

  .form-row { margin-bottom: 16px; }
  .form-row label {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px; font-weight: 600; margin-bottom: 8px; color: #444;
  }
  .form-row label .val {
    background: #FFFDE7; color: #F57F17; padding: 2px 10px;
    border-radius: 12px; font-size: 12px; font-weight: 700;
  }
  .form-row input[type="range"] { width: 100%; accent-color: #FFC107; height: 4px; }
  .range-labels { display: flex; justify-content: space-between; font-size: 11px; color: #aaa; margin-top: 4px; }
  .quick-btns { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
  .quick-btn {
    padding: 5px 10px; border: 1px solid #e0e0e0; border-radius: 6px;
    font-size: 11px; cursor: pointer; background: #fff; color: #666; transition: all .2s;
  }
  .quick-btn:hover { border-color: #FFC107; background: #FFFDE7; }
  .quick-btn.active { background: #FFC107; color: #333; border-color: #FFC107; font-weight: 700; }

  .mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .mode-btn {
    padding: 10px 4px; border: 1px solid #e8e8e8; border-radius: 8px;
    font-size: 11px; cursor: pointer; text-align: center; transition: all .2s;
    background: #fff; color: #666;
  }
  .mode-btn:hover { border-color: #FFC107; }
  .mode-btn.active {
    background: linear-gradient(135deg, #FFD93D, #FFC107);
    color: #333; border-color: transparent; font-weight: 700;
  }
  .mode-btn .emoji { display: block; font-size: 18px; margin-bottom: 2px; }
  .mode-desc {
    margin-top: 10px; padding: 10px 12px; background: #FFFDE7;
    border-radius: 8px; font-size: 11px; color: #666; line-height: 1.6;
    border-left: 3px solid #FFC107; min-height: 36px;
  }
  .mode-desc b { color: #F57F17; }

  /* 折叠面板 */
  .collapse-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; background: #f9f9f9; border-radius: 8px;
    cursor: pointer; user-select: none; margin-top: 10px;
    border: 1px solid #eee; transition: background .2s;
  }
  .collapse-header:hover { background: #f0f0f0; }
  .collapse-header .title { font-size: 13px; font-weight: 600; color: #333; }
  .collapse-header .arrow { font-size: 12px; color: #999; transition: transform .2s; }
  .collapse-header.open .arrow { transform: rotate(180deg); }
  .collapse-body { display: none; margin-top: 8px; }
  .collapse-body.open { display: block; }

  .switch-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 0; border-bottom: 1px solid #f5f5f5;
  }
  .switch-row:last-child { border-bottom: none; }
  .switch-row .label { font-size: 13px; font-weight: 500; }
  .switch-row .desc { font-size: 11px; color: #999; margin-top: 2px; }
  .switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
  .switch input { opacity: 0; width: 0; height: 0; }
  .slider-sw {
    position: absolute; cursor: pointer; inset: 0;
    background: #ccc; border-radius: 24px; transition: .3s;
  }
  .slider-sw:before {
    content: ""; position: absolute; height: 18px; width: 18px;
    left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .3s;
  }
  .switch input:checked + .slider-sw { background: #FFC107; }
  .switch input:checked + .slider-sw:before { transform: translateX(20px); }

  .btn {
    display: inline-block; padding: 12px 20px; border: none;
    border-radius: 10px; font-size: 14px; font-weight: 700;
    cursor: pointer; transition: all .2s;
  }
  .btn-primary {
    background: linear-gradient(135deg, #FFD93D, #FFC107);
    color: #333; width: 100%;
  }
  .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(255,193,7,0.4); }
  .btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
  .btn-outline {
    background: #fff; color: #666; border: 1px solid #ddd; flex: 1; font-size: 12px; padding: 10px;
  }
  .btn-outline:hover { background: #f5f5f5; }

  .result-wrap {
    background: #fff; border-radius: 12px; padding: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    overflow: hidden; max-width: 100%; box-sizing: border-box;
  }
  .result-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;
  }
  .result-header h3 { font-size: 15px; font-weight: 700; }
  .result-header .size-tag {
    font-size: 12px; color: #F57F17; background: #FFFDE7;
    padding: 3px 10px; border-radius: 10px; font-weight: 600;
  }
  .zoom-bar {
    display: flex; align-items: center; gap: 6px; margin-bottom: 10px;
    padding: 8px 10px; background: #f9f9f9; border-radius: 8px; flex-wrap: wrap;
  }
  .zoom-bar span { font-size: 12px; color: #888; margin-right: 4px; }
  .zoom-btn {
    padding: 4px 10px; border: 1px solid #ddd; border-radius: 5px;
    font-size: 11px; cursor: pointer; background: #fff; color: #555; transition: all .2s;
  }
  .zoom-btn:hover { border-color: #FFC107; background: #FFFDE7; }
  .zoom-btn.active { background: #FFC107; color: #333; border-color: #FFC107; font-weight: 700; }
  .zoom-slider { flex: 1; min-width: 80px; accent-color: #FFC107; }
  .edit-bar {
    display: flex; align-items: center; gap: 6px; margin-bottom: 10px;
    padding: 8px 10px; background: #f9f9f9; border-radius: 8px; flex-wrap: wrap;
  }
  .edit-btn {
    padding: 5px 12px; border: 1px solid #ddd; border-radius: 6px;
    font-size: 12px; cursor: pointer; background: #fff; color: #555; transition: all .2s;
  }
  .edit-btn:hover { border-color: #FFC107; background: #FFFDE7; }
  .edit-btn.active { background: #FFC107; color: #333; border-color: #FFC107; font-weight: 700; }

  .fill-picker { background: #f0f7ff; border-radius: 8px; padding: 10px; border: 1px solid #e0e8f0; }
  .fill-series-row { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
  .fill-series-btn {
    padding: 5px 12px; border: 1px solid #ccc; border-radius: 6px;
    font-size: 12px; cursor: pointer; background: #fff; color: #555; font-weight: 600;
  }
  .fill-series-btn:hover { border-color: #2196F3; background: #E3F2FD; }
  .fill-series-btn.active { background: #2196F3; color: #fff; border-color: #2196F3; }
  .fill-color-row { display: flex; gap: 4px; flex-wrap: wrap; max-height: 120px; overflow-y: auto; padding: 4px; background: #fff; border-radius: 6px; }
  .fill-color-btn {
    width: 28px; height: 28px; border-radius: 4px; border: 2px solid #ddd;
    cursor: pointer; position: relative; flex-shrink: 0;
  }
  .fill-color-btn:hover { border-color: #333; transform: scale(1.1); }
  .fill-color-btn.active { border-color: #FF5722; box-shadow: 0 0 0 2px #FF5722; }
  .fill-color-btn .fcode { position: absolute; bottom: -1px; right: 1px; font-size: 7px; color: #333; background: rgba(255,255,255,0.8); padding: 0 2px; border-radius: 2px; }

  .batch-del-picker { background: #FFEBEE; border-radius: 8px; padding: 10px; border: 1px solid #FFCDD2; }
  .batch-del-colors { display: flex; gap: 6px; flex-wrap: wrap; max-height: 120px; overflow-y: auto; padding: 4px; background: #fff; border-radius: 6px; }
  .batch-del-color {
    display: flex; flex-direction: column; align-items: center;
    min-width: 48px; padding: 4px 6px; border-radius: 6px;
    background: #fafafa; border: 1px solid #f0f0f0; cursor: pointer;
    transition: all .2s;
  }
  .batch-del-color:hover { border-color: #F44336; background: #FFEBEE; transform: scale(1.05); }
  .batch-del-color .swatch { width: 28px; height: 28px; border-radius: 4px; border: 1px solid rgba(0,0,0,0.1); margin-bottom: 2px; }
  .batch-del-color .code { font-size: 10px; font-weight: 700; color: #555; }
  .batch-del-color .cnt { font-size: 9px; color: #999; }

  .canvas-container {
    overflow: auto; background: #fafafa; border-radius: 8px;
    padding: 20px; display: flex; justify-content: center; align-items: flex-start;
    min-height: 200px;
    -webkit-overflow-scrolling: touch;
    width: 100%; box-sizing: border-box;
  }
  .canvas-inner {
    cursor: default; max-width: 100%;
    display: inline-block;
  }
  #beadCanvas { image-rendering: pixelated; display: block; max-width: none; }

  .stats-section { margin-top: 16px; }
  .stats-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 14px; background: #FFFDE7; border-radius: 8px; margin-bottom: 12px;
  }
  .stats-header .total { font-size: 14px; font-weight: 700; color: #F57F17; }
  .stats-header .count { font-size: 12px; color: #888; }
  .sort-btn.active { background: #FFC107 !important; border-color: #FFC107 !important; color: #333; font-weight: 700; }
  .color-grid { display: flex; flex-wrap: wrap; gap: 8px; }
  .color-chip {
    display: flex; flex-direction: column; align-items: center;
    min-width: 56px; padding: 6px 8px; border-radius: 8px;
    background: #fafafa; border: 1px solid #f0f0f0;
  }
  .color-chip .swatch {
    width: 32px; height: 32px; border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.1); margin-bottom: 4px;
  }
  .color-chip .code { font-size: 11px; font-weight: 700; }
  .color-chip .num { font-size: 11px; color: #888; }

  .actions-row { display: flex; gap: 8px; margin-top: 14px; }
  .empty-state {
    text-align: center; padding: 60px 20px; color: #bbb;
    background: #fff; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  }
  .empty-state .icon { font-size: 48px; margin-bottom: 10px; }
  .palette-badge {
    font-size: 11px; color: #888; background: #f9f9f9;
    padding: 8px 10px; border-radius: 6px; margin-bottom: 14px; line-height: 1.6;
  }
  .palette-badge b { color: #F57F17; }

  .modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.85);
    z-index: 9999; justify-content: center; align-items: center; padding: 20px;
  }
  .modal-overlay.show { display: flex; }
  .modal-content {
    background: #fff; border-radius: 12px; padding: 16px; max-width: 95vw; max-height: 95vh;
    overflow: auto; position: relative;
  }
  .modal-close {
    position: absolute; top: 10px; right: 14px; font-size: 24px;
    cursor: pointer; color: #999; background: none; border: none; z-index: 10;
  }
  .modal-close:hover { color: #333; }
  .modal-content canvas { max-width: 100%; }

  /* 裁剪弹窗 */
  .crop-content {
    background: #fff; border-radius: 12px; padding: 16px; max-width: 90vw; max-height: 90vh;
    display: flex; flex-direction: column; position: relative;
  }
  .crop-header { text-align: center; margin-bottom: 12px; }
  .crop-header h3 { font-size: 16px; font-weight: 700; }
  .crop-area {
    position: relative; display: inline-block; margin: 0 auto;
    max-width: 70vw; max-height: 60vh; overflow: hidden;
    background: #f0f0f0; border-radius: 6px; user-select: none;
  }
  .crop-area img { display: block; max-width: 70vw; max-height: 60vh; pointer-events: none; }
  .crop-box {
    position: absolute; border: 2px dashed #FFC107; box-sizing: border-box;
    cursor: move; box-shadow: 0 0 0 9999px rgba(0,0,0,0.4);
  }
  .crop-handle {
    position: absolute; width: 14px; height: 14px; background: #FFC107;
    border: 2px solid #fff; border-radius: 50%; z-index: 2;
  }
  .crop-handle-tl { top: -7px; left: -7px; cursor: nwse-resize; }
  .crop-handle-tr { top: -7px; right: -7px; cursor: nesw-resize; }
  .crop-handle-bl { bottom: -7px; left: -7px; cursor: nesw-resize; }
  .crop-handle-br { bottom: -7px; right: -7px; cursor: nwse-resize; }
  .crop-actions { display: flex; justify-content: center; gap: 12px; margin-top: 14px; }

  /* 预览弹窗缩放 */
  .preview-zoom-bar {
    display: flex; justify-content: center; align-items: center; gap: 8px;
    margin-bottom: 10px; flex-wrap: wrap;
  }
  .preview-zoom-btn {
    padding: 6px 14px; font-size: 13px; border: 1px solid #ddd;
    background: #fff; border-radius: 6px; cursor: pointer; color: #333;
    transition: all .2s;
  }
  .preview-zoom-btn:hover { background: #f0f0f0; border-color: #FFC107; }
  .preview-zoom-btn:active { background: #FFC107; color: #fff; }
  .preview-zoom-val {
    font-size: 14px; font-weight: 700; color: #FF5722; min-width: 50px; text-align: center;
  }
  .preview-canvas-wrap {
    width: 100%; max-height: 70vh; overflow: auto;
    background: #f5f5f5; border-radius: 6px; padding: 10px;
    display: flex; justify-content: center; align-items: flex-start;
  }
  .preview-canvas-wrap canvas {
    display: block; transform-origin: top center;
    transition: transform .15s ease;
  }

  /* 颜色选择弹窗 */
  .color-modal-content {
    background: #fff; border-radius: 12px; padding: 16px; max-width: 90vw; max-height: 90vh;
    display: flex; flex-direction: column; position: relative; width: 600px;
  }
  .color-modal-header { text-align: center; margin-bottom: 12px; position: relative; }
  .color-modal-header h3 { font-size: 16px; font-weight: 700; }
  .color-series-tabs {
    display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap; justify-content: center;
  }
  .series-tab {
    padding: 5px 12px; border: 1px solid #ddd; border-radius: 6px;
    font-size: 12px; cursor: pointer; background: #fff; color: #666; font-weight: 600;
  }
  .series-tab:hover { border-color: #FFC107; }
  .series-tab.active { background: #FFC107; color: #333; border-color: #FFC107; }
  .color-grid-modal {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 6px; max-height: 50vh; overflow-y: auto; padding: 8px;
  }
  .color-option {
    display: flex; flex-direction: column; align-items: center; padding: 4px;
    border-radius: 6px; cursor: pointer; border: 2px solid transparent; transition: all .15s;
  }
  .color-option:hover { border-color: #FFC107; transform: scale(1.05); }
  .color-option.selected { border-color: #FFC107; background: #FFFDE7; box-shadow: 0 0 0 2px #FFC107; }
  .color-option .swatch {
    width: 36px; height: 36px; border-radius: 4px; border: 1px solid rgba(0,0,0,0.15);
  }
  .color-option .code { font-size: 10px; font-weight: 700; margin-top: 2px; color: #555; }
  .color-modal-actions {
    display: flex; gap: 10px; margin-top: 12px; padding-top: 10px;
    border-top: 1px solid #eee;
  }

  @media (max-width: 900px) {
    .container { grid-template-columns: 1fr; padding: 0 10px; margin: 10px auto; gap: 10px; }
    .panel { padding: 14px; }
    .header h1 { font-size: 17px; }
    .header p { font-size: 11px; }
    .canvas-container { padding: 10px; max-height: none; }
    .result-wrap { padding: 12px; }
    .edit-bar { gap: 4px; padding: 6px 8px; }
    .edit-btn { padding: 5px 8px; font-size: 11px; }
    .zoom-bar { gap: 4px; padding: 6px 8px; }
    .zoom-btn { padding: 4px 7px; font-size: 10px; }
    .actions-row { flex-wrap: wrap; }
    .btn-outline { font-size: 11px; padding: 8px 6px; }
    .color-modal-content { width: 95vw !important; max-width: 95vw; padding: 12px; }
    .color-grid-modal { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; max-height: 55vh; }
    .color-option .swatch { width: 32px; height: 32px; }
    .stats-header { flex-wrap: wrap; gap: 6px; padding: 8px 10px; }
    .stats-header .total { font-size: 12px; }
    .color-chip { min-width: 48px; padding: 4px 6px; }
    .color-chip .swatch { width: 26px; height: 26px; }
    .mode-grid { grid-template-columns: repeat(3, 1fr); }
    .mode-btn { padding: 8px 2px; font-size: 11px; }
    .result-header h3 { font-size: 13px; }
    .result-header .size-tag { font-size: 11px; padding: 2px 8px; }
    .sort-btn { font-size: 10px !important; padding: 3px 6px !important; }
  }
  @media (max-width: 480px) {
    .header { padding: 10px 12px; }
    .header h1 { font-size: 15px; }
    .panel { padding: 12px; border-radius: 10px; }
    .panel-title { font-size: 13px; margin-bottom: 10px; }
    .form-row { margin-bottom: 12px; }
    .form-row label { font-size: 12px; }
    .quick-btn { padding: 4px 8px; font-size: 10px; }
    .canvas-container { max-height: none; padding: 8px; }
    .edit-btn { padding: 4px 6px; font-size: 10px; }
    .btn-primary { font-size: 13px; padding: 10px; }
    .color-chip { min-width: 42px; }
  }

/* ===== 手机端适配：两栏变单栏堆叠 ===== */
@media (max-width: 768px) {
  .gen-full .container {
    grid-template-columns: 1fr;
    max-width: 100%;
    margin: 0;
    padding: 0 10px;
  }
  .gen-full .panel {
    padding: 14px;
    border-radius: 14px;
  }
  .gen-full .canvas-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .gen-full .canvas-inner {
    min-width: 320px;
  }
  .gen-full .zoom-bar {
    flex-wrap: wrap;
    gap: 4px;
  }
  .gen-full .zoom-bar .zoom-btn {
    padding: 4px 8px;
    font-size: 11px;
  }
  .gen-full .mode-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  .gen-full .edit-bar {
    flex-wrap: wrap;
    gap: 4px;
  }
  .gen-full .edit-btn {
    font-size: 11px;
    padding: 5px 8px;
  }
  .gen-full .stats-header {
    flex-wrap: wrap;
    gap: 6px;
  }
  .gen-full .color-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }
  .gen-full .switch-row {
    padding: 8px 0;
  }
  .gen-full .collapse-header {
    padding: 10px 12px;
  }
  .gen-full .quick-btns {
    flex-wrap: wrap;
    gap: 4px;
  }
  .gen-full .quick-btn {
    flex: 1;
    min-width: 60px;
    padding: 6px 4px;
    font-size: 11px;
  }
  .gen-full .modal-content {
    width: 95vw !important;
    max-width: 95vw !important;
    padding: 14px;
  }
  .gen-full .preview-canvas-wrap {
    max-height: 60vh;
  }
  .gen-full .color-grid-modal {
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  }
}
/* 分享按钮区域 */
.gen-share-bar {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}
.gen-share-bar button {
  flex: 1;
}
