  html,
  body {
      height: 100%;
  }

  .main-container {
      height: 100%;
      overflow-y: auto;
      background-color: var(--page);
      box-sizing: border-box;
      padding-top: 80px;
  }

  .main-container::-webkit-scrollbar {
      width: 6px;
  }

  .main-container::-webkit-scrollbar-track {
      background-color: var(--page);
  }

  .main-container::-webkit-scrollbar-thumb {
      background-color: #d4cfc8;
      border-radius: 3px;
  }

  .main-container::-webkit-scrollbar-thumb:hover {
      background-color: #c4bfb8;
  }

  .my-project {
      height: 100%;
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      background-color: var(--page);
      color: #333;
      padding: clamp(54px, 6.2vw, 100px) var(--page-pad);
  }

  .project-content {
      display: flex;
      flex-direction: column;
      height: 100%;
      background-color: var(--page);
      position: relative;
      box-sizing: border-box;
  }

  /* ===== 顶部栏 ===== */
  .top-bar {
      display: flex;
      align-items: center;
      padding: 20px 0 60px;
      box-sizing: border-box;
      flex-shrink: 0;
      gap: 80px;
  }

  .search-input-wrapper {
      position: relative;
      width: 365px;
      min-width: 100px;
      height: 40px;
  }

  .search-input-wrapper input {
      width: 100%;
      height: 100%;
      padding: 0 40px 0 40px;
      border: 1px solid #6b6b6b;
      border-radius: 25px;
      background-color: transparent;
      font-size: 14px;
      outline: none;
      color: #333;
  }

  .search-input-wrapper input::placeholder {
      color: #999;
  }

  .search-input-wrapper .search-icon {
      position: absolute;
      left: 14px;
      top: 50%;
      transform: translateY(-50%);
      width: 20px;
      height: 20px;
      color: #333;
      pointer-events: none;
  }

  .search-input-wrapper .clear-icon {
      position: absolute;
      right: 14px;
      top: 50%;
      transform: translateY(-50%);
      width: 16px;
      height: 16px;
      line-height: 16px;
      cursor: pointer;
      color: #999;
      display: none;
  }

  .search-input-wrapper .clear-icon.visible {
      display: block;
  }
  
  .home-projects-title{
    flex-shrink: 0;
  }

  .nav-buttons {
      display: flex;
      gap: 20px;
  }

  .nav-btn {
      padding: 8px 16px;
      border: 1px solid #d2d2d2;
      border-radius: 20px;
      font-size: 14px;
      background: transparent;
      color: #6b6b6b;
      cursor: pointer;
      transition: all 0.25s;
      font-weight: 500;
      flex-shrink: 0;
  }

  .nav-btn:hover {
      background: #e8e4de;
  }

  .nav-btn.active {
      background: #ded7cf !important;
      border-color: #ded7cf !important;
      color: #333 !important;
  }

  /* ===== 项目列表容器 ===== */
  .project-container {
      width: 100%;
      flex: 1;
      padding: 0 0 30px;
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
      gap: 20px;
      box-sizing: border-box;
  }

  /* ===== 关键修复：让 projectList 的子元素直接参与 flex 布局 ===== */
  #projectList,
  #homeProjectList {
      display: contents;
  }

  /* ===== 项目卡片 ===== */
  .project-item {
      max-width: 350px;
      aspect-ratio: 270 / 377;
      border-radius: 30px;
      background: #fff;
      overflow: hidden;
      position: relative;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
      box-sizing: border-box;
      display: flex;
      flex-direction: column;
      cursor: pointer;
      transition:
          transform 0.3s,
          box-shadow 0.3s;
  }

  .project-item:hover {
      transform: translateY(-4px);
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  }

  /* 新建项目卡片 */
  .create-project {
      display: flex;
      align-items: center;
      justify-content: center;
      background-color: #fafafa;
      cursor: pointer;
      min-height: 300px;
  }

  .create-project-content {
      text-align: center;
  }

  .plus-icon {
      width: 55px;
      height: 55px;
      margin-bottom: 10px;
      display: block;
      margin-left: auto;
      margin-right: auto;
  }

  .create-text {
      color: #666;
      font-size: 20px;
  }

  /* 图片区域 */
  .project-img {
      width: 100%;
      height: 85%;
      position: relative;
      overflow: hidden;
      background: #e8e4de;
  }

  .project-img img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      transition: transform 0.3s;
  }

  .project-item:hover .project-img img {
      transform: scale(1.05);
  }

  .project-img-overlay {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.5);
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      transition: opacity 0.3s ease;
      pointer-events: none;
  }

  .project-img:hover .project-img-overlay {
      opacity: 1;
      pointer-events: auto;
  }

  /* 删除按钮：定位在 .project-img 右上角，hover 卡片时淡入；
           不依赖 .project-img-overlay 的 hover 状态，确保可见 */
  .delete-icon,
  .view-project {
      position: absolute;
      top: 12px;
      width: 36px;
      height: 36px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0;
      border: 0;
      border-radius: 50%;
      background: rgba(0, 0, 0, 0.55);
      color: #fff;
      cursor: pointer;
      z-index: 5;
      opacity: 0;
      transform: translateY(-4px);
      transition:
          opacity 0.22s ease,
          transform 0.22s ease,
          background 0.18s ease;
  }


  /* 删除按钮在最右侧，查看按钮在其左侧 */
  .delete-icon {
      right: 12px;
  }

  .view-project {
      right: 56px;
  }

  /* hover 图片区域时显示（与图片上的其他 overlay 行为一致） */
  .project-img:hover .delete-icon,
  .delete-icon:focus-visible,
  .project-img:hover .view-project,
  .view-project:focus-visible {
      opacity: 1;
      transform: translateY(0);
  }

  .delete-icon:hover {
      background: rgba(220, 53, 69, 0.95);
      transform: scale(1.06);
  }

  .view-project:hover {
      background: #d2976c;
      transform: scale(1.06);
  }

  .delete-icon img,
  .view-project img {
      width: 20px;
      height: 20px;
      display: block;
      pointer-events: none;
      filter: brightness(0) invert(1);
  }


  .enter-canvas-btn {
      color: #fff;
      font-size: 22px;
      font-weight: bold;
      cursor: pointer;
      text-align: center;
      padding: 12px 24px;
      transition: transform 0.3s ease;
  }

  .enter-canvas-btn:hover {
      transform: scale(1.05);
  }

  .project-info {
      padding: 20px;
  }

  .project-name {
      color: #444444;
      margin-bottom: 6px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      display: flex;
      align-items: center;
      gap: 6px;
      font-family: Inter;
      font-weight: 500;
      font-size: 14px;
      line-height: 140%;
      letter-spacing: 5%;
  }

  .project-name span {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
  }

  .project-name-date {
      display: flex;
      justify-content: space-between;
      align-items: center;
  }

  .project-date {
      color: #444444;
      font-family: Inter;
      font-weight: 300;
      font-size: 12px;
      line-height: 140%;
      letter-spacing: 5%;
  }

  .action-btn {
      cursor: pointer;
      background: #DED7CF;
      border: 0.3px solid #444444;
      color: #444444;
      display: flex;
      align-items: center;
      justify-content: center;
      border-width: 0.3px;
      border-radius: 20px;
      font-family: Inter;
      font-weight: 300;
      font-size: 12px;
      line-height: 140%;
      letter-spacing: 5%;
      padding: 3px 8px;
  }

  .action-btn:hover {
      background: #cec5bb;
  }

  /* ===== 加载更多/没有更多/加载错误 ===== */
  /* 关键：让 .load-more-container 在 flex 容器中占满整行 */
  .load-more-container {
      /* flex 子项占满整行（项目容器是 flex-wrap: wrap） */
      flex: 0 0 100%;
      width: 100%;
      /* 紧跟最后一张卡片，避免被挤到一行/一列 */
      align-self: stretch;
      /* 文字居中 */
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 28px 0 8px 0;
      color: #6b6b6b;
      font-size: 14px;
      text-align: center;
      /* 不让卡片 hover 蒙层覆盖到 */
      position: relative;
      z-index: 1;
  }

  .load-more-spinner {
      display: inline-block;
      width: 14px;
      height: 14px;
      border: 2px solid #d4cfc8;
      border-top-color: #6b6b6b;
      border-radius: 50%;
      animation: load-more-spin 0.8s linear infinite;
  }

  @keyframes load-more-spin {
      to {
          transform: rotate(360deg);
      }
  }

  .load-more-container.load-more--nomore {
      font-size: 14px;
      color: #999;
  }

  @media (min-width: 768px) and (max-width: 991px) {
     
      .top-bar {
          padding: 20px 0;
      }

      .project-container {
          padding: 0 0 30px;
      }
  }

  @media (max-width: 767px) {
      .main-container {
          padding-top: 120px;
      }

      .top-bar {
          flex-wrap: wrap;
          gap: 12px;
          padding: 16px 0;
      }

      .search-input-wrapper {
          width: 200px !important;
          min-width: 120px;
          height: 34px;
      }

      .project-container {
          padding: 0 0 30px;
      }
  }

  /* 回到顶部 */
  .back-to-top {
      position: fixed;
      bottom: 40px;
      right: 40px;
      width: 36px;
      height: 36px;
      border-radius: 18px;
      background: #ded7cf;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
      transition:
          opacity 0.3s,
          transform 0.3s;
      opacity: 0;
      pointer-events: none;
      z-index: 999;
  }

  .back-to-top.show {
      opacity: 1;
      pointer-events: auto;
  }

  .back-to-top:hover {
      background: #cec5bb;
  }

  .back-to-top svg {
      fill: #333;
  }


  /* 模板样式 */
  /* 模板区嵌套在 mainContainer 内，统一由 mainContainer 滚动，避免双重滚动条 */
  #previewContainer {
      height: auto !important;
      overflow: visible !important;
  }

  .preview-containers {
      height: 100%;
      overflow-y: auto;
      background-color: var(--page);
      box-sizing: border-box;
  }

  .preview-containers::-webkit-scrollbar {
      width: 6px;
  }

  .preview-containers::-webkit-scrollbar-track {
      background-color: var(--page);
  }

  .preview-containers::-webkit-scrollbar-thumb {
      background-color: #d4cfc8;
      border-radius: 3px;
  }

  .preview-containers::-webkit-scrollbar-thumb:hover {
      background-color: #c4bfb8;
  }

  /* ---- 图片预览容器 (grid) ---- */
  .image-preview-container {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
      gap: 20px;
      padding: 0 0 30px;
      align-content: start;
      box-sizing: border-box;
      min-height: 200px;
  }

  .image-preview-container::-webkit-scrollbar {
      width: 8px;
      height: 8px;
  }

  .image-preview-container::-webkit-scrollbar-track {
      background: transparent;
  }

  .image-preview-container::-webkit-scrollbar-thumb {
      background: #d4c5b9;
      border-radius: 4px;
  }

  .image-preview-container::-webkit-scrollbar-thumb:hover {
      background: #c4b5a9;
  }

  .image-preview-container {
      scrollbar-width: thin;
      scrollbar-color: #d4c5b9 transparent;
  }

  /* ---- 加载 & 空状态 ---- */
  .loading-more,
  .no-more {
      padding: 30px 0 60px;
      text-align: center;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      min-height: 60px;
      font-size: 14px;
      color: #666;
  }


  .loading-spinner {
      display: inline-block;
      width: 16px;
      height: 16px;
      border: 2px solid #d4cfc8;
      border-top-color: #6b6b6b;
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
      vertical-align: middle;
  }

  @keyframes spin {
      to {
          transform: rotate(360deg);
      }
  }

  .loading-text {
      font-size: 14px;
      color: #666;
  }

  .empty-placeholder {
      grid-column: 1 / -1;
      text-align: center;
      padding: 60px 20px;
      color: #909399;
      font-size: 16px;
  }

  /* ---- 卡片 ---- */
  .image-card {
      border-radius: 12px;
      overflow: hidden;
      cursor: pointer;
      transition: all 0.3s;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      display: flex;
      flex-direction: column;
      background-color: #fff;
      aspect-ratio: 1 / 1;
      max-width: 350px;
  }

  .image-card:hover {
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  }


  .card-wrapper {
      display: flex;
      flex-direction: column;
      height: 100%;
  }

  /* ---- 图片容器 ---- */
  .product-image-container {
      flex: 1;
      overflow: hidden;
      position: relative;
      width: 100%;
      background: #e8e4de;
  }

  .preview-image {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
      transition: transform 0.3s ease;
  }

  .image-card:hover .preview-image {
      transform: scale(1.03);
  }

  /* ---- 图片悬浮覆盖层：查看详情 ---- */
  .image-overlay {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.15);
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      transition: opacity 0.3s ease;
      pointer-events: none;
      backdrop-filter: blur(2px);
  }

  .product-image-container:hover .image-overlay {
      opacity: 1;
      pointer-events: auto;
  }

  .view-detail-text {
      color: #fff;
      font-size: 14px;
      font-weight: 500;
      letter-spacing: 2px;
      padding: 10px 24px;
      transition: all 0.25s ease;
      cursor: pointer;
      user-select: none;
      background: transparent;
      display: flex;
      align-items: center;
  }

  .view-detail-text:hover {
      transform: scale(1.05);
  }

  .view-detail-icon {
      width: 20px;
      height: 20px;
      margin-right: 4px;
  }

  /* ---- 底部信息区 ---- */
  .product-info-container {
      width: 100%;
      padding: 16px 18px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      /* min-height: 80px; */
      background: #fff;
      box-sizing: border-box;
      border-top: 1px solid #f0f0f0;
  }

  .left-section {
      display: flex;
      align-items: center;
      gap: 6px;
      min-width: 0;
      flex: 1;
  }

  .template-project-name {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-family: Inter;
      font-weight: 400;
      font-size: 14px;
      line-height: 140%;
      letter-spacing: 5%;
      color: #444444;
  }

  .project-type {
      padding: 0 6px;
      flex-shrink: 0;
      font-size: 10px;
      color: #000000;
      border-radius: 20px;
      border: 1px solid #666;
      height: 17px;
      background: #fafafa;
      font-weight: 300;
      display: flex;
      align-items: center;
      justify-content: center;
  }

  /* 模板分类筛选栏布局（与 tab 按钮同处一行，位于「模板项目」右侧） */
  .template-filter-bar {
      display: inline-flex;
      align-items: center;
      margin-left: 12px;
  }

  .template-filter-bar .filter-select {
      width: 180px;
  }

  .filter-select {
      height: 36px;
      /* 不被压缩变形 */
      flex-shrink: 0;
      white-space: nowrap;
  }

  /* ===== 自定义筛选下拉 ===== */
  .filter-dropdown {
      position: relative;
      display: inline-block;
      width: 140px;
      max-width: 170px;
  }

  .filter-dropdown__trigger {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      width: 100%;
      height: 36px;
      padding: 0 12px;
      border: 1px solid #6b6b6b;
      border-radius: 20px;
      background-color: var(--page);
      font-size: 13px;
      color: #333;
      cursor: pointer;
      user-select: none;
      outline: none;
      transition: border-color 0.18s, background-color 0.18s, color 0.18s;
  }

  .filter-dropdown__trigger:hover {
      border-color: #333;
  }

  .filter-dropdown.open .filter-dropdown__trigger {
      border-color: #333;
      background-color: #ece7df;
  }

  /* 已选：与 .nav-button.active 同样的 “Pill 选中” 视觉 */
  .filter-dropdown.has-value .filter-dropdown__trigger {
      background-color: #ded7cf;
      border-color: #ded7cf;
      color: #333;
      font-weight: 500;
  }

  .filter-dropdown.has-value.open .filter-dropdown__trigger {
      background-color: #d3cbc1;
      border-color: #d3cbc1;
  }

  .filter-dropdown__trigger:focus-visible {
      box-shadow: 0 0 0 2px rgba(51, 51, 51, 0.18);
  }

  .filter-dropdown__label {
      flex: 1;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
  }

  /* 占位灰：还未选择任何项时 */
  .filter-dropdown .filter-dropdown__label.is-placeholder {
      color: #999;
  }

  .filter-dropdown__caret {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 12px;
      height: 12px;
      color: currentColor;
      flex-shrink: 0;
      transition: transform 0.18s;
  }

  .filter-dropdown__caret svg {
      display: block;
      width: 100%;
      height: 100%;
  }

  .filter-dropdown.open .filter-dropdown__caret {
      transform: rotate(180deg);
      color: currentColor;
  }

  /* 已选项时显示删除按钮 */
  .filter-dropdown__clear {
      display: none;
      align-items: center;
      justify-content: center;
      width: 14px;
      height: 14px;
      padding: 0;
      border: 0;
      border-radius: 50%;
      background: rgba(51, 51, 51, 0.18);
      color: #fff;
      cursor: pointer;
      flex-shrink: 0;
  }

  .filter-dropdown__clear:hover {
      background: rgba(51, 51, 51, 0.4);
  }

  /* 已选且悬停时才显示清除按钮 */
  .filter-dropdown.has-value:hover .filter-dropdown__clear {
      display: inline-flex;
  }

  /* 已选且悬停时隐藏箭头，改显示清除按钮 */
  .filter-dropdown.has-value:hover .filter-dropdown__caret {
      display: none;
      /* 已选状态：X 占主导 */
  }

  /* 弹层（菜单）：用 position: fixed 以避免被父级 overflow 裁剪 */
  .filter-dropdown__menu {
      position: fixed;
      min-width: 120px;
      max-height: 260px;
      overflow-y: auto;
      background-color: #fff;
      border: 1px solid #d4cfc8;
      border-radius: 12px;
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
      padding: 6px 0;
      z-index: 998;
      opacity: 0;
      transform: translateY(-4px);
      pointer-events: none;
      transition: opacity 0.16s, transform 0.16s;
  }

  .filter-dropdown.open .filter-dropdown__menu {
      opacity: 1;
      transform: translateY(0);
      pointer-events: auto;
  }

  /* ===== 弹层滚动条样式（与项目米色调保持一致） ===== */
  .filter-dropdown__menu::-webkit-scrollbar {
      width: 8px;
  }

  .filter-dropdown__menu::-webkit-scrollbar-track {
      background: transparent;
      margin: 4px 0;
  }

  .filter-dropdown__menu::-webkit-scrollbar-thumb {
      background-color: #d4cfc8;
      border-radius: 4px;
      border: 2px solid #fff;
      /* 让 thumb 看起来更细 */
  }

  .filter-dropdown__menu::-webkit-scrollbar-thumb:hover {
      background-color: #b8b1a8;
  }

  .filter-dropdown__menu::-webkit-scrollbar-corner {
      background: transparent;
  }

  /* Firefox */
  .filter-dropdown__menu {
      scrollbar-width: thin;
      scrollbar-color: #d4cfc8 transparent;
  }

  /* 滚动时略微缩小 padding，让滚条不贴着首/尾 */
  .filter-dropdown__menu {
      scroll-padding-block: 6px;
  }

  .filter-dropdown__option {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 8px 14px;
      font-size: 13px;
      color: #333;
      cursor: pointer;
      user-select: none;
      transition: background-color 0.12s, color 0.12s;
  }

  .filter-dropdown__option:hover {
      background-color: var(--page);
  }

  .filter-dropdown__option.is-selected {
      background-color: #ece7df;
      color: #000;
      font-weight: 500;
  }

  .filter-dropdown__option-check {
      opacity: 0;
      color: #333;
      flex-shrink: 0;
  }

  .filter-dropdown__option.is-selected .filter-dropdown__option-check {
      opacity: 1;
  }

  .filter-dropdown__empty {
      padding: 12px 14px;
      font-size: 13px;
      color: #999;
      text-align: center;
      cursor: default;
      user-select: none;
  }

  /* ===== 原生 select 兼容（如果 JS 还没接管时的兜底） ===== */
  .filter-select select {
      display: none;
  }

  .filter-select select:focus {
      border-color: #333;
  }

  .filter-select select.has-value {
      background-color: #ded7cf !important;
  }

  .filter-select select option {
      background-color: #fff;
  }

  /* ===== 模板预览弹窗（只读画布） ===== */
  .template-preview-modal[hidden] {
      display: none;
  }

  .template-preview-modal {
      position: fixed;
      inset: 0;
      z-index: 10000;
      display: flex;
      align-items: center;
      justify-content: center;
  }

  .template-preview-backdrop {
      position: absolute;
      inset: 0;
      background: rgba(0, 0, 0, 0.55);
      backdrop-filter: blur(2px);
  }

  .template-preview-dialog {
      position: relative;
      width: calc(100vw - 80px);
      max-width: 1600px;
      height: calc(100vh - 80px);
      max-height: 940px;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      border-radius: 16px;
      background: #fff;
      box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
      animation: template-preview-in 0.22s ease;
  }

  @keyframes template-preview-in {
      from {
          opacity: 0;
          transform: translateY(12px) scale(0.99);
      }

      to {
          opacity: 1;
          transform: translateY(0) scale(1);
      }
  }

  .template-preview-frame {
      display: block;
      width: 100%;
      height: 100%;
      border: 0;
      background: #eae8e2;
  }

  /* 全屏预览：铺满整个视口 */
  .template-preview-modal.is-fullscreen .template-preview-dialog {
      width: 100vw;
      max-width: none;
      height: 100vh;
      max-height: none;
      border-radius: 0;
  }

  .template-preview-modal.is-fullscreen .template-preview-backdrop {
      background: transparent;
      backdrop-filter: none;
  }

  /* 弹窗打开时锁定页面滚动 */
  body.template-preview-open {
      overflow: hidden;
  }

  body.template-preview-open .main-container {
      overflow: hidden;
  }

  @media (max-width: 768px) {
      .template-preview-dialog {
          width: 100vw;
          height: 100vh;
          max-height: none;
          border-radius: 0;
      }
  }