* {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    html,
    body {
      padding: 0;
      height: 100%;
      overflow: hidden;
    }

    #canvas {
      display: block;
      width: 100%;
      height: 100%;
      touch-action: none;
      background: var(--bg);
    }

    /* 主工具栏 */
    .main-bar {
      position: fixed;
      bottom: 20px;
      left: 50%;
      transform: translateX(-50%);
      background: var(--btn-bg);
      backdrop-filter: blur(10px);
      padding: 10px 18px;
      border-radius: 24px;
      box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
      display: flex;
      gap: 10px;
      align-items: center;
      z-index: 999;
    }

    .tool-btn {
      width: 44px;
      height: 44px;
      border-radius: 14px;
      border: none;
      background: transparent;
      font-size: 22px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background 0.2s;
    }

    .tool-btn:hover {
      background: var(--btn-bg);
    }

    .tool-btn.active {
      background: #e8e8e8;
      color: #333;
    }

    .divider {
      width: 2px;
      height: 32px;
      background: var(--bg);
      border-radius: 1px;
    }

    /* 颜色 */
    .color-item {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      border: 3px solid transparent;
      cursor: pointer;
      transition: transform 0.2s;
    }

    .color-item.active {
      border-color: #000;
      transform: scale(1.1);
    }

    /* 颜色面板 */
    .color-panel {
      position: fixed;
      bottom: 100px;
      left: 50%;
      transform: translateX(-50%);
      background: var(--text);
      padding: 12px;
      border-radius: 16px;
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
      display: none;
      grid-template-columns: repeat(6, 1fr);
      gap: 8px;
      z-index: 998;
    }

    .color-panel.show {
      display: grid;
    }

    /* 取色器 */
    #colorPicker {
      width: 0;
      height: 0;
      opacity: 0;
      position: absolute;
    }

    .color-picker-btn {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: linear-gradient(135deg, #f44336, #9c27b0, #2196f3, #4caf50);
      cursor: pointer;
      border: 2px solid #eee;
    }

    /* 粗细滑块 */
    .size-slider {
      position: fixed;
      bottom: 100px;
      left: 50%;
      transform: translateX(-50%);
      background: var(--btn-bg);

      padding: 12px 20px;
      border-radius: 16px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
      display: none;
      align-items: center;
      gap: 10px;
      z-index: 998;
    }

    .size-slider.show {
      display: flex;
    }

    #sizeRange {
      width: 120px;
    }

    /* 形状面板 */
    .shape-panel {
      position: fixed;
      bottom: 100px;
      left: 50%;
      transform: translateX(-50%);
      background: var(--btn-bg);
      padding: 12px;
      border-radius: 16px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
      display: none;
      gap: 8px;
      z-index: 998;
    }

    .shape-panel.show {
      display: flex;
    }

    .shape-btn {
      width: 40px;
      height: 40px;
      border-radius: 12px;
      border: none;
      background: var(--btn-bg);
      cursor: pointer;
      font-size: 18px;
      transition: background 0.2s;
    }

    .shape-btn:hover {
      background: var(--btn-bg);

    }

    .shape-btn.active {
      background: var(--btn-hover);
    }

    /* 文字输入 */
    #textInput {
      position: fixed;
      display: none;
      padding: 10px 14px;
      border: 2px solid #3b82f6;
      border-radius: 8px;
      outline: none;
      font-size: 18px;
      z-index: 1001;
      background: var(--btn-bg);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
      min-width: 100px;
    }

    /* 导入图片 */
    #imageInput {
      display: none;
    }

    /* 页面工具栏 */
    .page-bar {
      position: fixed;
      /* top: 20px; */
      bottom: 100px;
      left: 50%;
      transform: translateX(-50%);
      background: var(--btn-bg);
      backdrop-filter: blur(10px);
      padding: 8px 16px;
      border-radius: 20px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
      display: flex;
      align-items: center;
      gap: 8px;
      z-index: 999;
    }

    .page-btn {
      width: 36px;
      height: 36px;
      border-radius: 12px;
      border: none;
      background: transparent;
      font-size: 18px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background 0.2s;
    }

    .page-btn:hover {
      background: #f5f5f5;
    }

    .page-info {
      font-size: 15px;
      color: var(--text);
      min-width: 60px;
      text-align: center;
      font-weight: 500;
    }

    /* ========== 新增：页面预览抽屉 ========== */
    /* 抽屉开关按钮 */
    .drawer-toggle {
      position: fixed;
      bottom: 20px;
      right: 20px;
      width: 48px;
      height: 48px;
      border-radius: 50%;
      border: none;
      background: var(--btn-hover);
      
      backdrop-filter: blur(10px);
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
      font-size: 20px;
      cursor: pointer;
      z-index: 999;
      transition: all 0.2s ease;
    }

    .drawer-toggle:hover {
      transform: scale(1.05);
      background: var(--bg);
    }

    /* 右侧抽屉容器 */
    .page-drawer {
      position: fixed;
      top: 0;
      right: 0;
      width: 300px;
      height: 100vh;
      background: var(--btn-hover);
      backdrop-filter: blur(10px);
      box-shadow: -4px 0 20px rgba(0, 0, 0, 0.08);
      z-index: 998;
      transform: translateX(100%);
      transition: transform 0.3s ease;
      padding: 20px 16px;
      display: flex;
      flex-direction: column;
    }

    /* 抽屉展开状态 */
    .page-drawer.open {
      transform: translateX(0);
    }

    /* 抽屉头部 */
    .drawer-header {
      font-size: 18px;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 16px;
      padding-bottom: 12px;
      border-bottom: 1px solid #eee;
    }

    /* 缩略图列表 */
    .thumbnail-list {
      flex: 1;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 12px;
      padding-right: 4px;
    }

    .thumbnail-list::-webkit-scrollbar {
      width: 6px;
    }

    .thumbnail-list::-webkit-scrollbar-track {
      background: #f5f5f5;
      border-radius: 3px;
    }

    .thumbnail-list::-webkit-scrollbar-thumb {
      background: #ccc;
      border-radius: 3px;
    }

    /* 单个缩略图项 */
    .thumbnail-item {
      width: 100%;
      border-radius: 12px;
      overflow: hidden;
      cursor: pointer;
      border: 3px solid transparent;
      transition: all 0.2s ease;
      position: relative;
      background: #fff;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    }

    .thumbnail-item:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    /* 当前页高亮 */
    .thumbnail-item.active {
      border-color: #3b82f6;
    }

    /* 缩略图图片 */
    .thumbnail-img {
      width: 100%;
      height: auto;
      display: block;
      background: #fff;
    }

    /* 缩略图页码 */
    .thumbnail-index {
      position: absolute;
      bottom: 8px;
      left: 8px;
      background: rgba(0, 0, 0, 0.6);
      color: #fff;
      font-size: 12px;
      padding: 2px 8px;
      border-radius: 10px;
    }

    /* 移动端适配 */
    @media (max-width: 768px) {
      .page-drawer {
        width: 220px;
      }

      .main-bar {
        padding: 8px 12px;
        gap: 6px;
        bottom: 16px;
      }

      .tool-btn {
        width: 40px;
        height: 40px;
        font-size: 20px;
      }

      .drawer-toggle {
        bottom: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
      }
    }