:root {
  --bg: #fff;
  --card-bg: #fff;
  --text: #222;
  --text-sec: #666;
  --text-muted: #999;
  --red: #e06060;
  --gold: #b8944a;
  --border: #eee;
  --nav-h: 50px;
  --top-h: 44px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { overflow-x: hidden; width: 100%; position: relative; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, "PingFang SC", "Noto Sans SC", sans-serif; padding-bottom: calc(var(--nav-h) + 10px); overflow-x: hidden; width: 100%; }
a { text-decoration: none; color: inherit; }
img { display: block; }

/* ── 顶部 ── */
.top-bar { position: sticky; top: 0; z-index: 100; background: #fff; display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; height: var(--top-h); border-bottom: 1px solid var(--border); }
.logo { font-size: 1.1rem; font-weight: 800; color: var(--red); letter-spacing: 1px; }
.top-actions { display: flex; gap: 12px; }
.top-btn { width: 32px; height: 32px; border-radius: 50%; background: #f5f5f5; display: flex; align-items: center; justify-content: center; color: var(--text); font-size: 0.9rem; }

/* ── 分类标签 ── */
.cat-scroll { display: flex; gap: 6px; padding: 10px 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cat-scroll::-webkit-scrollbar { display: none; }
.cat-tag { white-space: nowrap; padding: 4px 14px; border-radius: 16px; font-size: 0.8rem; color: var(--text-sec); background: #f5f5f5; }
.cat-tag.active { background: var(--red); color: #fff; }

/* ── SEO头部 ── */
.seo-header { padding: 0 16px 4px; }
.seo-h1 { font-size: 0; height: 0; margin: 0; overflow: hidden; }
.seo-desc { font-size: 0; height: 0; margin: 0; overflow: hidden; }
.seo-sub { font-size: 0; height: 0; margin: 0; overflow: hidden; }
.seo-sub a { color: var(--red); text-decoration: underline; }
.breadcrumb { padding: 6px 16px; font-size: 0.72rem; color: var(--text-muted); display: none; }
.breadcrumb a { color: var(--text-muted); }


/* ── 瀑布流 ── */
.feed-grid {
  column-count: 2;
  column-gap: 8px;
  padding: 0 12px;
}
.feed-card {
  break-inside: avoid;
  margin-bottom: 8px;
  display: inline-flex;
  flex-direction: column;
  width: 100%;
  background: var(--card-bg);
}
/* 所有缩略图：默认等比缩放 */
.card-img-wrap img {
  width: 100%;
  height: auto;
  display: block;
  background: #f0f0f0;
}
/* 竖屏图：固定高度，column布局正确计算卡片尺寸 */
.feed-card:not(.landscape) .card-img-wrap {
  width: 100%;
  height: 28vh;
  overflow: hidden;
}
.feed-card:not(.landscape) .card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}
/* 横屏图：窄列自然矮小 */
.feed-card.landscape .card-img-wrap img {
  max-height: 25vh;
}

.card-footer { padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; }
.card-user { display: flex; align-items: center; gap: 4px; font-size: 0.75rem; color: var(--text-sec); max-width: 70%; }
.card-avatar { font-size: 1rem; color: var(--text-muted); }
.card-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-actions { font-size: 0.7rem; color: var(--text-muted); }
.card-actions i { margin-right: 2px; }/* ── 无限滚动加载 ── */
.scroll-sentinel { text-align: center; padding: 24px 20px 40px; }
.loading-spinner { font-size: 0.8rem; color: var(--text-muted); display: none; }
.scroll-sentinel.loading .loading-spinner { display: block; }
.scroll-sentinel-error a { display: inline-block; padding: 8px 24px; border: 1px solid var(--border); border-radius: 20px; font-size: 0.85rem; color: var(--text-sec); background: #fafafa; }
.scroll-end { font-size: 0.8rem; color: var(--text-muted); padding: 20px; display: none; }
.scroll-sentinel.ended .scroll-end { display: block; }
.scroll-sentinel.ended .loading-spinner { display: none; }


/* ── SEO底部内容 ── */
.seo-content { padding: 20px 16px 8px; border-top: 1px solid #f0f0f0; margin-top: 8px; }
.seo-content h2 { font-size: 1rem; color: #222; margin-bottom: 8px; }
.seo-content p { font-size: 0.78rem; color: #999; line-height: 1.6; margin-bottom: 6px; }
.seo-content p:last-child { margin-bottom: 0; }

/* ── 底部导航 ── */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; height: var(--nav-h); background: #fff; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-around; z-index: 999; padding-bottom: env(safe-area-inset-bottom); }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 0.6rem; color: var(--text-muted); }
.nav-item i { font-size: 1.2rem; }
.nav-item.active { color: var(--red); }
.nav-upload i { font-size: 1.8rem; color: var(--red); }

/* ── 详情页 ── */
.detail-page { background: #000; min-height: 100vh; position: relative; }
.detail-top-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: linear-gradient(rgba(0,0,0,0.5), transparent); }
.back-btn, .detail-btn { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.15); display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 0.9rem; border: none; cursor: pointer; }
.detail-actions { display: flex; gap: 8px; }
.detail-btn span { font-size: 0.7rem; margin-left: 2px; }
/* 详情页：竖屏壁纸 */
.detail-img-area { display: flex; align-items: center; justify-content: center; min-height: 50vh; position: relative; }
.detail-img { max-width: 100%; max-height: 85vh; object-fit: contain; cursor: pointer; }
/* 详情页：横屏壁纸 */
.detail-img-area.landscape { min-height: auto; padding: 10px 0; }
.detail-img-area.landscape .detail-img { max-height: 80vh; max-width: 100%; width: auto; height: auto; object-fit: contain; }

/* ── 左右翻页箭头 ── */
.nav-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 44px; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,0.5); font-size: 1.1rem; cursor: pointer; z-index: 5; transition: color 0.15s; }
.nav-arrow:hover { color: #fff; }
.nav-prev { left: 4px; }
.nav-next { right: 4px; }

/* ── 全屏预览 ── */
.fullscreen-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 9999; background: #000; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.fullscreen-overlay.active { opacity: 1; pointer-events: auto; }
.fs-close { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.15); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1rem; cursor: pointer; z-index: 10; }
.fs-img { max-width: 100%; max-height: 100vh; object-fit: contain; }

/* ── 小红书风格底部菜单 ── */
.action-sheet-mask { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 10000; background: rgba(0,0,0,0.4); }
.action-sheet { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10001; padding: 8px 12px calc(12px + env(safe-area-inset-bottom)); animation: sheetUp 0.25s ease; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.action-sheet-content { background: #fff; border-radius: 14px; overflow: hidden; }
.action-sheet-item { display: flex; align-items: center; gap: 10px; padding: 14px 16px; font-size: 0.9rem; color: #222; border-bottom: 1px solid #f0f0f0; cursor: pointer; }
.action-sheet-item i { width: 20px; text-align: center; color: var(--text-sec); }
.action-sheet-cancel { background: #fff; border-radius: 14px; margin-top: 8px; text-align: center; padding: 14px; font-size: 0.9rem; color: var(--text-sec); cursor: pointer; }

.detail-bottom { background: #fff; border-radius: 16px 16px 0 0; margin-top: -16px; position: relative; z-index: 10; padding: 16px; color: var(--text); }
.detail-info-row { display: flex; gap: 8px; margin-bottom: 6px; }
.detail-cat { background: #f0f0f0; padding: 2px 10px; border-radius: 10px; font-size: 0.72rem; color: var(--text-sec); }
.detail-res { font-size: 0.72rem; color: var(--text-muted); }
.detail-title { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.detail-user-row { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-sec); margin-bottom: 8px; }
.detail-date { color: var(--text-muted); font-size: 0.72rem; }
.detail-desc { font-size: 0.82rem; color: var(--text); line-height: 1.6; }

/* ── 分享 ── */
.share-section { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid #f5f5f5; margin-bottom: 12px; }
.share-label { font-size: 0.78rem; color: var(--text-muted); }
.share-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: #fff; display: inline-flex; align-items: center; justify-content: center; color: var(--text-sec); font-size: 0.9rem; cursor: pointer; }
.share-btn:hover { background: #f5f5f5; }

/* ── 相关推荐 ── */
.related-section { margin-top: 12px; }
.related-section h4 { font-size: 0.9rem; margin-bottom: 10px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.related-card { border-radius: 8px; overflow: hidden; aspect-ratio: 9/16; }
.related-card img { width: 100%; height: 100%; object-fit: cover; }

/* 评论区 */
.comment-section { margin-top: 12px; }
.comment-section h4 { font-size: 0.9rem; margin-bottom: 10px; }
.comment-form { display: flex; gap: 8px; margin-bottom: 12px; }
.comment-form input { flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: 20px; font-size: 0.8rem; outline: none; }
.comment-form button { padding: 8px 16px; border: none; background: var(--red); color: #fff; border-radius: 20px; font-size: 0.8rem; cursor: pointer; }
.comment-item { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f5f5f5; font-size: 0.8rem; }
.comment-item i { font-size: 1.2rem; color: var(--text-muted); }
.comment-body { flex: 1; }
.comment-body strong { font-size: 0.8rem; }
.comment-body p { margin: 2px 0; }
.comment-body small { color: var(--text-muted); font-size: 0.7rem; }
.no-comment { color: var(--text-muted); font-size: 0.8rem; }

/* ── 登录/注册 ── */
.auth-page { padding: 60px 24px 120px; }
.auth-header { text-align: center; margin-bottom: 36px; }
.auth-header h2 { font-size: 1.4rem; font-weight: 700; }
.auth-header p { color: var(--text-muted); font-size: 0.85rem; margin-top: 6px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.input-group-custom { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; height: 48px; background: #fafafa; }
.input-group-custom input { flex: 1; border: none; background: transparent; font-size: 0.9rem; outline: none; height: 100%; }
.input-prefix { font-size: 0.85rem; color: var(--text-sec); padding-right: 8px; border-right: 1px solid var(--border); margin-right: 8px; }
.code-group { padding-right: 4px; }
.code-group button { white-space: nowrap; padding: 8px 14px; border: none; background: var(--red); color: #fff; border-radius: 8px; font-size: 0.78rem; cursor: pointer; }
.code-group button:disabled { background: #ccc; }
.auth-submit { height: 48px; border: none; background: var(--red); color: #fff; font-size: 1rem; font-weight: 600; border-radius: 10px; cursor: pointer; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 0.85rem; color: var(--text-muted); }
.auth-switch a { color: var(--red); }

/* ── 上传 ── */
.upload-page { padding: 0 0 100px; }
.upload-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.upload-header h3 { font-size: 1rem; }
.upload-form { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.upload-area { border: 2px dashed var(--border); border-radius: 12px; padding: 40px; text-align: center; color: var(--text-muted); cursor: pointer; }
.upload-preview img { width: 100%; max-height: 300px; object-fit: contain; border-radius: 12px; background: #f5f5f5; }
.ufield { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.85rem; outline: none; background: #fafafa; }

/* ── 个人页 ── */
.profile-page { padding: 0 0 80px; }
.profile-head { text-align: center; padding: 24px 16px 16px; }
.profile-head h3 { font-size: 1.1rem; margin: 8px 0; }
.profile-stats { display: flex; justify-content: center; gap: 24px; font-size: 0.8rem; color: var(--text-sec); }
.profile-tabs { display: flex; border-bottom: 1px solid var(--border); }
.tab-btn { flex: 1; padding: 10px; border: none; background: none; font-size: 0.85rem; color: var(--text-muted); cursor: pointer; position: relative; }
.tab-btn.active { color: var(--red); font-weight: 600; }
.tab-btn.active::after { content: ''; position: absolute; bottom: 0; left: 20%; right: 20%; height: 2px; background: var(--red); border-radius: 1px; }
.tab-content { display: none; padding: 8px; }
.tab-content.active { display: block; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; }
.profile-wp img { width: 100%; aspect-ratio: 0.7; object-fit: cover; border-radius: 4px; background: #f0f0f0; }

/* ── 空状态 ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: 0.85rem; }

/* ── 小屏适配 (iPhone SE / 安卓小屏 360-400px) ── */
@media (max-width: 400px) {
  .feed-grid { gap: 6px; padding: 0 8px; }
  .card-footer { padding: 6px 8px; }
  .card-user { font-size: 0.65rem; }
  .card-actions { font-size: 0.6rem; }
  .top-bar { padding: 6px 12px; height: 40px; }
  .logo { font-size: 1rem; }
  .cat-scroll { padding: 8px 12px; gap: 4px; }
  .cat-tag { padding: 3px 10px; font-size: 0.72rem; }
  .auth-page { padding: 40px 16px 100px; }
  .auth-header h2 { font-size: 1.2rem; }
  .input-group-custom { height: 44px; }
  .detail-top-bar { padding: 8px 12px; }
  .nav-up { top: 60px; }
  .nav-down { bottom: 100px; }
  .detail-bottom { padding: 12px; }
  .detail-title { font-size: 0.9rem; }
  .profile-grid { gap: 3px; }
  .profile-head { padding: 16px 12px 12px; }
  .profile-stats { gap: 16px; font-size: 0.72rem; }
  .upload-form { padding: 12px; }
  .upload-area { padding: 24px; }
}

/* ── 中屏适配 (iPhone X/12/13 390-430px) ── */
@media (min-width: 401px) and (max-width: 480px) {
  .auth-page { padding: 50px 20px 110px; }
  .feed-grid { padding: 0 10px; }
}

/* ── iPhone 安全区 ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-nav { padding-bottom: env(safe-area-inset-bottom); }
  .detail-bottom { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}
