  /* ========== 发现页容器 ========== */
  /*
     * 让 body 作为滚动容器，原先 .discover-container 自带 overflow:auto + min-height:100vh
     * 当瀑布流超过 100vh 时容器内部撑高而 body 不滚，导致 scroll 事件不再触发，
     * 「触底加载」失效。改为取消容器的内部滚动。
     *
     * 上下内边距写死；左右内边距由 JS 动态设置（initMainContainerMargins），
     * 自适应窗口宽度，最小 50px。
     */
  .discover-container {
      width: 100%;
      padding: calc(80px + var(--notif-offset, 0px)) 50px 40px;
      background-color: var(--page);
      box-sizing: border-box;
  }

  /* ========== 顶部搜索 ========== */
  .discover-header {
      height: 80px;
      display: flex;
      align-items: center;
      flex-shrink: 0;
  }

  .nav-container {
      display: flex;
      align-items: center;
      gap: 20px;
      font-size: 14px;
      width: 100%;
  }

  .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;
      cursor: pointer;
      color: #999;
      display: none;
  }

  .search-input-wrapper .clear-icon.visible {
      display: block;
  }

  /* ========== 瀑布流 ========== */
  .waterfall-container {
      width: 100%;
  }

  .image-grid {
      position: relative;
      min-height: 500px;
      transition: height 0.4s cubic-bezier(0.22, 1, 0.36, 1);
      display: block;
      margin-top: 20px;
  }

  .grid-item {
      position: absolute;
      border-radius: 30px;
      overflow: hidden;
      background: #f5f5f5;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
      transition: box-shadow 0.3s ease, border 0.3s ease;
      cursor: pointer;
      display: flex;
      justify-content: center;
      align-items: center;
      border: none;
      visibility: hidden;
      left: 0;
      top: 0;
  }

  .grid-item[data-positioned="true"] {
      visibility: visible;
      animation: wf-fade-in 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  }

  @keyframes wf-fade-in {
      from {
          opacity: 0;
          transform: translateY(8px);
      }

      to {
          opacity: 1;
          transform: translateY(0);
      }
  }

  .grid-item:hover {
      border: 3px solid #ded7cf;
  }

  .image-content {
      width: 100%;
      height: 100%;
      position: relative;
      overflow: hidden;
  }

  .grid-image {
      width: 100%;
      height: 100%;
      object-fit: cover;
      transition: transform 0.3s ease;
  }

  .grid-item:hover .grid-image {
      transform: scale(1.05);
  }

  .image-actions {
      height: 40px;
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10px;
      background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
      opacity: 0;
      transition: opacity 0.3s ease;
  }

  .grid-item:hover .image-actions,
  .grid-item.selected .image-actions {
      opacity: 1;
  }

  .action-icon-container {
      display: flex;
      align-items: center;
      gap: 6px;
  }

  .action-icon {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      /* background: rgba(255, 255, 255, 0.2); */
      transition: background 0.2s;
  }

  /* .action-icon:hover {
      background: rgba(255, 255, 255, 0.4);
    } */
  .action-icon img {
      width: 20px;
      height: 20px;
      display: block;
  }

  .like-count {
      color: #fff;
      font-size: 14px;
  }

  .author-avatar {
      width: 24px;
      height: 24px;
      border-radius: 50%;
      overflow: hidden;
      background: #ccc;
  }

  .author-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
  }

  /* ========== 加载状态 ========== */
  .loading-indicator {
      padding: 30px 20px;
      text-align: center;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      min-height: 60px;
  }

  .loading-spinner {
      display: inline-block;
      width: 16px;
      height: 16px;
      border: 2px solid #d4cfc7;
      border-top-color: #6b6b6b;
      border-radius: 50%;
      animation: wf-spin 0.8s linear infinite;
  }

  @keyframes wf-spin {
      to {
          transform: rotate(360deg);
      }
  }

  .loading-text {
      color: #999;
      font-size: 14px;
  }

  .no-more-data {
      padding: 30px 20px;
      text-align: center;
      color: #999;
      font-size: 14px;
      margin-top: 20px;
  }

  .empty-container {
      padding: 60px 20px;
      text-align: center;
      color: #999;
      font-size: 16px;
  }

  /* 隐藏节点工具类（用于 JS 控制显隐，不再用 innerHTML 动态注入） */
  .hidden {
      display: none !important;
  }

  /* ========== 详情弹窗 ========== */
  .modal-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.45);
      z-index: 2000;
      justify-content: center;
      align-items: center;
      padding: 20px;
  }

  .modal-overlay.open {
      display: flex;
  }

  .modal-content {
      background: #fff;
      border-radius: 20px;
      width: 80vw;
      max-width: 1600px;
      height: 80vh;
      display: flex;
      overflow: hidden;
      position: relative;
  }

  .modal-close {
      position: absolute;
      top: 16px;
      right: 16px;
      z-index: 10;
      width: 36px;
      height: 36px;
      border-radius: 50%;
      border: none;
      background: rgba(255, 255, 255, 0.9);
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
      cursor: pointer;
      font-size: 18px;
      color: #333;
      transition: all 0.2s;
  }

  .modal-close:hover {
      background: #fff;
      transform: scale(1.05);
  }

  .detail-preview-section {
      width: 70%;
      display: flex;
      align-items: center;
      justify-content: center;
      background: #f5f5f5;
      overflow: hidden;
  }

  .detail-preview-section img {
      width: 100%;
      height: 100%;
      object-fit: cover;
  }

  .detail-info-section {
      width: 30%;
      padding: 30px;
      overflow-y: auto;
      background: #fff;
      border-left: 1px solid #e0e0e0;
      display: flex;
      flex-direction: column;
  }

  .detail-author {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 20px;
  }

  .detail-author img {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      object-fit: cover;
  }

  .detail-author-name {
      font-size: 16px;
      font-weight: 500;
  }

  .user-avatar {
      width: 14px !important;
      height: 14px !important;
      border-radius: 50%;
  }

  .detail-analysis {
      font-size: 14px;
      line-height: 1.6;
      color: #444;
      margin: 20px 0;
      /* max-height: 200px;
      overflow-y: auto; */
  }

  .detail-tags {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-bottom: 20px;
  }

  .detail-tag {
      padding: 4px 12px;
      border-radius: 20px;
      font-size: 12px;
      color: #666;
      border: 1px solid #666;
  }

  .detail-bottom-actions {
      margin-top: auto;
      display: flex;
      justify-content: space-between;
      align-items: center;
  }

  .detail-like-btn {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 16px;
      border: none;
      background: transparent;
      font-size: 14px;
      cursor: pointer;
      border-radius: 6px;
      transition: background 0.2s;
  }

  .detail-like-btn img {
      width: 20px;
      height: 20px;
  }

  /* 登录弹窗已迁移到 public/js/loginModal.js，由 window.openLoginModal() 触发 */

  /* ========== 回到顶部 ========== */
  .back-top-btn {
      position: fixed;
      right: 24px;
      bottom: 24px;
      width: 36px;
      height: 36px;
      border-radius: 18px;
      background: #ded7cf;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      border: none;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
      transition: transform 0.2s;
      z-index: 100;
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
  }

  .back-top-btn.visible {
      opacity: 1;
      visibility: visible;
  }

  .back-top-btn:hover {
      transform: translateY(-2px);
  }

  /* ========== 响应式 ========== */
  @media (max-width: 1024px) {

      .detail-preview-section {
          width: 65%;
      }

      .detail-info-section {
          width: 35%;
          padding: 20px;
      }
  }

  @media (max-width: 768px) {
      .discover-header {
          height: 60px;
      }

      .search-input-wrapper {
          width: 200px !important;
          min-width: 120px;
          height: 34px;
      }

      .discover-container {
          padding-bottom: 20px;
          padding-top: calc(120px + var(--notif-offset, 0px));
      }

      .modal-content {
          flex-direction: column;
          width: 95vw;
          height: 90vh;
      }

      .detail-preview-section {
          width: 100%;
          height: 50%;
      }

      .detail-info-section {
          width: 100%;
          height: 50%;
          border-left: none;
          border-top: 1px solid #e0e0e0;
          padding: 16px;
      }

      .grid-item {
          border-radius: 16px;
      }

      .image-actions {
          opacity: 1;
          padding: 6px 8px;
          height: 32px;
      }

      .action-icon {
          width: 24px;
          height: 24px;
      }

      .action-icon img {
          width: 18px;
          height: 18px;
      }
  }

  @media (max-width: 480px) {
      .search-input-wrapper {
          width: 150px !important;
          min-width: 80px;
      }

      .discover-container {
          padding-bottom: 16px;
          /* 左右内边距由 JS 计算 */
      }
  }
  
 @media (max-width: 480px) {
     .discover-container {
         padding-top: calc(160px + var(--notif-offset, 0px));
     }
 }