* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  background: #f5f5f5;
  color: #333;
  max-width: 600px;
  margin: 0 auto;
}

/* ── 顶部导航 ── */
.top-nav {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  z-index: 100;
  background: #fff;
  padding: 10px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.top-nav + * {
  margin-top: 50px;
}

.top-nav .nav-title {
  font-size: 17px;
  font-weight: 600;
  text-align: center;
}

/* ── 搜索框 ── */
.search-bar {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid #eee;
}

.search-bar input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 14px;
  outline: none;
  background: #f7f7f7;
}

/* ── 分类 Tab ── */
.category-tabs {
  display: flex;
  gap: 0;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid #eee;
  overflow-x: auto;
  scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }

.category-tab {
  white-space: nowrap;
  padding: 10px 14px;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  flex-shrink: 0;
}
.category-tab.active {
  color: #07c160;
  border-bottom-color: #07c160;
  font-weight: 600;
}

/* ── 资料卡片列表 ── */
.material-list {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.material-card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  gap: 12px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.material-card:active { opacity: .8; }

.material-card .cover {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  background: #f0f0f0;
  flex-shrink: 0;
}

.material-card .cover-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  background: linear-gradient(135deg, #e0e0e0, #f5f5f5);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.material-card .cover-placeholder img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.material-card .info { flex: 1; min-width: 0; }
.material-card .title {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.material-card .meta {
  font-size: 12px;
  color: #999;
  margin-bottom: 6px;
}
.material-card .price {
  font-size: 16px;
  font-weight: 700;
  color: #e64340;
}
.material-card .sales {
  font-size: 12px;
  color: #999;
  margin-left: 8px;
}

/* ── 加载更多 ── */
.load-more {
  text-align: center;
  padding: 16px;
  color: #999;
  font-size: 14px;
}

/* ── 详情页 ── */
.detail-cover {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  object-position: top;
  background: #f0f0f0;
}

.detail-cover-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #e8f5e9, #f1f8e9);
  display: flex;
  align-items: center;
  justify-content: center;
}
.detail-cover-placeholder img {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.detail-body { padding: 16px; background: #fff; }
.detail-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.detail-meta  { font-size: 13px; color: #999; margin-bottom: 12px; }
.detail-price { font-size: 24px; font-weight: 700; color: #e64340; }
.detail-desc  { font-size: 14px; color: #555; line-height: 1.7; margin-top: 16px; }
.detail-desc p{
      margin-bottom: unset;
}
/* 底部购买栏 */
.buy-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  background: #fff;
  padding: 10px 16px;
  box-shadow: 0 -1px 6px rgba(0,0,0,.1);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 100;
}

.buy-bar .price-label { font-size: 20px; font-weight: 700; color: #e64340; flex: 1; }

.btn-buy {
  background: #07c160;
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 10px 32px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-buy:active { opacity: .85; }
.btn-buy:disabled { background: #ccc; }

.btn-download {
  background: #1989fa;
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 10px 32px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-download:active { opacity: .85; }

/* ── 订单页 ── */
.order-list { padding: 12px 16px; display: flex; flex-direction: column; gap: 12px; }

.order-card {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.order-card .order-title {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 6px;
}

.order-card .order-meta {
  font-size: 12px;
  color: #999;
  margin-bottom: 8px;
}

.order-card .order-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-card .order-amount {
  font-size: 16px;
  font-weight: 700;
  color: #e64340;
}

.btn-dl {
  background: #07c160;
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 6px 18px;
  font-size: 13px;
  cursor: pointer;
}
.btn-dl:active { opacity: .85; }

/* ── 底部导航 ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  background: #fff;
  border-top: 1px solid #eee;
  display: flex;
  z-index: 99;
}

.bottom-nav a {
  flex: 1;
  text-align: center;
  padding: 8px 0 6px;
  text-decoration: none;
  color: #999;
  font-size: 11px;
}

.bottom-nav a.active { color: #07c160; }
.bottom-nav .nav-icon {
  width: 24px;
  height: 24px;
  display: block;
  margin: 0 auto 2px;
}
.bottom-nav .nav-icon svg {
  width: 24px;
  height: 24px;
}

/* 页面底部留白（避免被底部导航遮挡）*/
.page-bottom-pad { height: 60px; }

/* ── Toast 提示 ── */
.m-toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: rgba(30, 30, 30, 0.88);
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 14px;
  line-height: 1.5;
  white-space: nowrap;
  max-width: 80vw;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity .22s ease, transform .22s ease;
}

.m-toast.m-toast--success { background: rgba(7, 193, 96, 0.92); }
.m-toast.m-toast--danger  { background: rgba(220, 53, 69, 0.92); }
.m-toast.m-toast--warning { background: rgba(255, 153, 0, 0.92); color: #fff; }

.m-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 隐藏原始 toast 容器 */
#toastContainer { display: none !important; }

/* ── 全屏加载遮罩 ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.loading-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.loading-overlay .loading-box {
  background: rgba(30, 30, 30, 0.9);
  border-radius: 14px;
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.loading-overlay .loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.loading-overlay .loading-text {
  color: #fff;
  font-size: 15px;
}

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

/* ── 下载页 ── */
.download-page {
  padding: 40px 20px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.download-file-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}

.download-title {
  font-size: 17px;
  font-weight: 600;
  color: #333;
  line-height: 1.5;
  text-align: center;
  width: 100%;
}

.download-card {
  width: 100%;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.download-card .card-label {
  font-size: 12px;
  color: #999;
  margin-bottom: 8px;
}

.download-url-text {
  font-size: 12px;
  color: #555;
  word-break: break-all;
  line-height: 1.6;
  max-height: 72px;
  overflow-y: auto;
  display: block;
}

.download-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.btn-copy-link {
  flex: 1;
  background: #f0f0f0;
  color: #333;
  border: none;
  border-radius: 24px;
  padding: 13px 0;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}
.btn-copy-link:active { opacity: .8; }

.btn-start-download {
  flex: 1;
  background: #07c160;
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 13px 0;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn-start-download:active { opacity: .85; }

.download-hint {
  font-size: 12px;
  color: #bbb;
  text-align: center;
}

/* ── 分享浮动按钮 ── */
.share-fab {
  position: fixed;
  bottom: 145px;
  right: 16px;
  width: 44px;
  height: 44px;
  background: #07c160;
  color: #fff;
  border: none;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.share-fab svg { width: 22px; height: 22px; }
.share-fab:active { opacity: .8; }

/* ── 分享弹窗 ── */
.share-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.share-modal {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  width: calc(100% - 48px);
  max-width: 360px;
  max-height: 88vh;
  overflow-y: auto;
}

.share-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.share-modal-title { font-size: 17px; font-weight: 700; color: #111; }
.share-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: #bbb;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

#sharePreview { margin-bottom: 12px; text-align: center; }

.share-img-preview {
  width: 100%;
  border-radius: 10px;
  box-shadow: 0 2px 14px rgba(0,0,0,.12);
  display: block;
}

.share-loading {
  padding: 40px 0;
  text-align: center;
  color: #999;
  font-size: 14px;
}

.share-hint {
  font-size: 12px;
  color: #aaa;
  text-align: center;
  margin: 0 0 14px;
}

.share-dl-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: #07c160;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.share-dl-btn:active { opacity: .85; }

/* ── 下载页 ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}
.empty-state .empty-icon { font-size: 56px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }
