/* ========== 基础重置 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; scroll-behavior: smooth; }
body { min-height: 100%; }
:root {
  --nav-height: 60px;
  --top-bar-height: 54px;
  --bg: #07070e;
  --card-bg: rgba(255,255,255,0.04);
  --card-border: rgba(255,255,255,0.06);
  --text: #f0f0f5;
  --text-secondary: rgba(255,255,255,0.45);
  --accent: #7c6aff;
  --accent2: #a855f7;
  --accent-light: rgba(124,106,255,0.12);
  --border: rgba(255,255,255,0.06);
  --radius: 14px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --gradient: linear-gradient(135deg, #7c6aff 0%, #a855f7 50%, #6d5dfa 100%);
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
.hidden { display: none !important; }
img { display: block; }

/* 暗色滚动条 */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ========== 认证页 ========== */
#auth-page {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 70;
  overflow: hidden;
}
#auth-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(124,106,255,0.15) 0%, transparent 70%);
  top: -200px;
  right: -100px;
  animation: authGlow 8s ease-in-out infinite alternate;
}
#auth-page::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(168,85,247,0.1) 0%, transparent 70%);
  bottom: -150px;
  left: -100px;
  animation: authGlow 8s ease-in-out infinite alternate-reverse;
}
@keyframes authGlow {
  0% { transform: scale(1) translate(0, 0); }
  100% { transform: scale(1.2) translate(30px, -20px); }
}
.auth-card {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-radius: 24px;
  padding: 44px 36px;
  width: 380px;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  position: relative;
  z-index: 1;
}
.auth-title {
  font-size: 32px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}
.auth-subtitle {
  color: rgba(255,255,255,0.35);
  font-size: 14px;
  margin-bottom: 28px;
  letter-spacing: 1px;
}
.auth-tabs {
  display: flex;
  margin-bottom: 24px;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 3px;
}
.auth-tab {
  flex: 1;
  padding: 11px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 15px;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
}
.auth-tab.active {
  background: rgba(124,106,255,0.15);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(124,106,255,0.2);
}
.auth-form input {
  width: 100%;
  padding: 14px 18px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  color: #fff;
  font-size: 15px;
  outline: none;
  margin-bottom: 12px;
  transition: all 0.3s;
  letter-spacing: 0.3px;
}
.auth-form input:focus {
  border-color: rgba(124,106,255,0.5);
  background: rgba(124,106,255,0.04);
  box-shadow: 0 0 0 3px rgba(124,106,255,0.08);
}
.auth-form input::placeholder { color: rgba(255,255,255,0.22); }
.btn-primary {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: var(--gradient);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(124,106,255,0.3);
  letter-spacing: 0.5px;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(124,106,255,0.4);
}
.btn-primary:active { transform: translateY(0) scale(0.98); }
.auth-error {
  color: #ff6b6b;
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
}

/* ========== 顶栏 ========== */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--top-bar-height);
  padding: 0 16px;
  background: rgba(7, 7, 14, 0.8);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.top-bar-title {
  font-size: 18px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}
.back-btn {
  position: absolute;
  left: 8px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}
.back-btn:hover { color: #fff; }
.back-btn .back-label { font-size: 14px; font-weight: 600; }

/* ========== 小红书风格瀑布流 ========== */
#feed-page {
  min-height: 100vh;
  padding-bottom: calc(var(--nav-height) + 20px);
  background: var(--bg);
}
.waterfall-container {
  padding: 10px 10px 0 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

/* 瀑布流卡片 - 高级质感 */
.wf-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  border: 1px solid var(--card-border);
}
.wf-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(124,106,255,0.1), 0 4px 16px rgba(0,0,0,0.3);
  border-color: rgba(124,106,255,0.15);
}
.wf-card:active { transform: scale(0.97); }
.wf-card-media {
  width: 100%;
  position: relative;
  overflow: hidden;
  background: #0d0d14;
  aspect-ratio: 3/4;
}
.wf-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.wf-card:hover .wf-card-media img {
  transform: scale(1.06);
}
.wf-card-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.wf-card-media .text-card {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255,255,255,0.8);
  word-break: break-all;
  background: linear-gradient(135deg, rgba(124,106,255,0.08) 0%, rgba(168,85,247,0.06) 100%);
}
.wf-card-media .type-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 10px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.wf-card-media .type-badge::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #7c6aff;
}
.wf-card-body {
  padding: 12px 14px 14px 14px;
}
.wf-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
  margin-bottom: 8px;
}
.wf-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wf-card-author {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.wf-card-author img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.06);
}
.wf-card-author span {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wf-card-like {
  display: flex;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
  transition: all 0.25s;
  border-radius: 8px;
}
.wf-card-like:hover { color: #7c6aff; background: rgba(124,106,255,0.08); }
.wf-card-like.liked { color: #7c6aff; }
.wf-card-like svg { width: 14px; height: 14px; }
.wf-card-like.liked svg { fill: #7c6aff; stroke: #7c6aff; }

.feed-loading {
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ========== 详情页 ========== */
#detail-page {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  z-index: 60;
  background: var(--bg);
}
.detail-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 80px;
  background: var(--bg);
}
.detail-media {
  width: 100%;
  background: #0a0a14;
  display: flex;
  align-items: center;
  justify-content: center;
}
.detail-media img {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
}
.detail-media video {
  width: 100%;
  max-height: 60vh;
}
.detail-media .detail-text-content {
  padding: 48px 28px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1.9;
  color: #fff;
  white-space: pre-wrap;
  background: linear-gradient(135deg, rgba(124,106,255,0.06), rgba(168,85,247,0.04));
}
.detail-body {
  padding: 20px;
}
.detail-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 14px;
  line-height: 1.4;
  letter-spacing: -0.3px;
}
.detail-author {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.detail-author img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.08);
}
.detail-author-name {
  font-weight: 700;
  font-size: 15px;
}
.detail-author-bio {
  font-size: 12px;
  color: var(--text-secondary);
}
.detail-desc {
  font-size: 15px;
  color: rgba(255,255,255,0.65);
  line-height: 1.7;
  margin-bottom: 18px;
}
.detail-actions {
  display: flex;
  gap: 20px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.detail-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  padding: 8px 0;
  transition: all 0.2s;
}
.detail-action-btn:hover { color: #7c6aff; }
.detail-action-btn.liked { color: #7c6aff; }
.detail-action-btn svg { width: 22px; height: 22px; }
.detail-action-btn.liked svg { fill: #7c6aff; stroke: #7c6aff; }
.detail-likers-btn {
  background: rgba(124,106,255,0.1);
  border: 1px solid rgba(124,106,255,0.2);
  color: #7c6aff;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 18px;
  cursor: pointer;
  transition: all 0.2s;
}
.detail-likers-btn:hover { background: rgba(124,106,255,0.18); }

/* ========== 评论区 ========== */
.comments-section {
  padding: 0 20px;
}
.comments-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
}
.comment-item {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}
.comment-item img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.06);
}
.comment-body { flex: 1; min-width: 0; }
.comment-name {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}
.comment-text {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255,255,255,0.85);
  word-break: break-all;
}
.comment-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 5px;
}
.comment-time {
  font-size: 11px;
  color: rgba(255,255,255,0.2);
}
.comment-like-btn {
  display: flex;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.2);
  font-size: 11px;
  cursor: pointer;
  padding: 2px;
  transition: color 0.2s;
}
.comment-like-btn:hover { color: #7c6aff; }
.comment-like-btn.liked { color: #7c6aff; }
.comment-like-btn svg { width: 14px; height: 14px; }
.comment-like-btn.liked svg { fill: #7c6aff; stroke: #7c6aff; }
.comment-delete-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.2);
  font-size: 11px;
  cursor: pointer;
  padding: 2px;
  transition: color 0.2s;
}
.comment-delete-btn:hover { color: #ff6b6b; }

/* 评论回复 */
.comment-reply-btn {
  background: none; border: none; color: rgba(255,255,255,0.2);
  font-size: 11px; cursor: pointer; padding: 2px 6px;
  transition: color 0.2s;
}
.comment-reply-btn:hover { color: #7c6aff; }
.comment-reply-to {
  font-size: 12px; color: rgba(255,255,255,0.35);
  margin-bottom: 3px; padding: 2px 0;
}
.comment-reply-to .reply-name { color: #7c6aff; }

/* 回复提示条 */
.reply-bar {
  padding: 10px 20px; margin: 0 20px;
  background: rgba(124,106,255,0.08); border-radius: 10px;
  font-size: 13px; color: rgba(255,255,255,0.6);
  display: flex; align-items: center; justify-content: space-between;
}
.reply-bar.hidden { display: none; }
.reply-bar b { color: #7c6aff; }
.reply-bar button {
  background: none; border: none; color: rgba(255,255,255,0.3);
  font-size: 18px; cursor: pointer; padding: 0 4px; line-height: 1;
}
.reply-bar button:hover { color: #ff6b6b; }

/* 评论输入 */
.comment-input-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  background: rgba(7,7,14,0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255,255,255,0.06);
}
.comment-input-bar input {
  flex: 1;
  padding: 12px 18px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  font-size: 14px;
  outline: none;
  background: rgba(255,255,255,0.04);
  color: #fff;
  transition: all 0.3s;
}
.comment-input-bar input:focus {
  border-color: rgba(124,106,255,0.4);
  box-shadow: 0 0 0 3px rgba(124,106,255,0.06);
}
.comment-send-btn {
  padding: 10px 20px;
  background: var(--gradient);
  color: #fff;
  border: none;
  border-radius: 24px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(124,106,255,0.25);
  transition: all 0.2s;
}
.comment-send-btn:hover { box-shadow: 0 6px 18px rgba(124,106,255,0.35); }
.comment-send-btn:disabled { opacity: 0.4; }

/* 评论图片按钮 */
.comment-img-btn {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex-shrink: 0;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 50%; color: #999; cursor: pointer;
  transition: all 0.2s;
}
.comment-img-btn:hover { color: #7c6aff; border-color: #7c6aff; }

/* 评论图片预览 */
.comment-img-preview {
  position: relative; margin: 0 20px 10px; display: inline-block;
}
.comment-img-preview.hidden { display: none; }
.comment-img-preview img, .comment-img-preview video {
  max-width: 120px; max-height: 120px; border-radius: 10px;
  object-fit: cover; border: 1px solid rgba(255,255,255,0.08);
}
.comment-img-remove {
  position: absolute; top: -8px; right: -8px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,107,107,0.9); color: #fff; border: none;
  font-size: 14px; line-height: 20px; text-align: center;
  cursor: pointer;
}

/* 评论中的图片/视频 */
.comment-media {
  margin-top: 8px; border-radius: 10px;
  max-width: 200px; max-height: 200px; object-fit: cover;
  cursor: pointer; border: 1px solid rgba(255,255,255,0.06);
}
video.comment-media { max-width: 260px; max-height: 260px; }

/* ========== 发布页 ========== */
#publish-page {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  z-index: 60;
  background: var(--bg);
}
.publish-card {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}
#publish-form input[type="text"],
#publish-form textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  color: #fff;
  font-size: 14px;
  outline: none;
  margin-bottom: 14px;
  resize: vertical;
  font-family: inherit;
  transition: all 0.3s;
}
#publish-form input:focus,
#publish-form textarea:focus {
  border-color: rgba(124,106,255,0.4);
  box-shadow: 0 0 0 3px rgba(124,106,255,0.06);
}
#publish-form input::placeholder,
#publish-form textarea::placeholder { color: rgba(255,255,255,0.2); }

/* 上传区域 */
.pub-upload-area {
  position: relative;
  width: 100%;
  aspect-ratio: 1/1;
  max-height: 320px;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255,255,255,0.02);
  border: 2px dashed rgba(255,255,255,0.08);
  margin-bottom: 16px;
  cursor: pointer;
  transition: all 0.3s;
}
.pub-upload-area:hover {
  border-color: rgba(124,106,255,0.3);
  background: rgba(124,106,255,0.02);
}
#pub-file { display: none; }
.pub-upload-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: rgba(255,255,255,0.2);
  font-size: 14px;
}
.pub-upload-placeholder svg { opacity: 0.3; }
#pub-preview-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#pub-preview-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#pub-preview-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 14px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#pub-preview-overlay span {
  color: #fff;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
#pub-remove-file {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 8px;
  transition: background 0.2s;
}
#pub-remove-file:hover { background: rgba(255,60,60,0.5); }

/* 类型切换 */
.pub-type-switch {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.pub-type-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  border: 1.5px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
  color: rgba(255,255,255,0.35);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 500;
}
.pub-type-btn.active {
  border-color: #7c6aff;
  background: rgba(124,106,255,0.1);
  color: #7c6aff;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(124,106,255,0.15);
}
.pub-type-btn svg { flex-shrink: 0; }

/* 上传进度条 */
.pub-progress {
  width: 100%; margin-bottom: 14px; display: flex; align-items: center; gap: 10px;
}
.pub-progress.hidden { display: none; }
.pub-progress-bar {
  flex: 1; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.06);
  overflow: hidden; position: relative;
}
.pub-progress-bar::after {
  content: ''; position: absolute; left: 0; top: 0; height: 100%;
  border-radius: 3px;
  background: var(--gradient);
  transition: width 0.2s ease;
  width: var(--progress);
}
.pub-progress span {
  font-size: 13px; color: #7c6aff; font-weight: 600; min-width: 36px; text-align: right;
}

/* ========== 个人中心 ========== */
#profile-page, #user-page {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  z-index: 60;
  background: var(--bg);
}
.profile-card {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 10px;
}
.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.avatar-wrapper {
  position: relative;
  width: 68px;
  height: 68px;
  flex-shrink: 0;
}
.avatar-wrapper img {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(124,106,255,0.2);
  background: rgba(255,255,255,0.06);
}
.avatar-edit {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 24px;
  height: 24px;
  background: var(--gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  border: 2px solid var(--bg);
  box-shadow: 0 2px 8px rgba(124,106,255,0.3);
}
.profile-info { flex: 1; min-width: 0; }
.username-edit {
  display: flex;
  align-items: center;
  gap: 8px;
}
.username-edit h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }
.icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  transition: color 0.2s;
}
.icon-btn:hover { color: #7c6aff; }
.profile-bio {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
  line-height: 1.5;
}
.edit-form {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.edit-form input {
  flex: 1;
  padding: 11px 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: all 0.3s;
}
.edit-form input:focus {
  border-color: rgba(124,106,255,0.4);
  box-shadow: 0 0 0 3px rgba(124,106,255,0.06);
}
.btn-small {
  padding: 9px 16px;
  border: none;
  border-radius: 10px;
  background: var(--gradient);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(124,106,255,0.2);
}
.btn-secondary {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.6);
  box-shadow: none;
}
.profile-stats {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.stat span:first-child { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.stat span:last-child { font-size: 12px; color: var(--text-secondary); }
.section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
}
.my-works-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.my-work-item {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  background: rgba(255,255,255,0.03);
  transition: transform 0.2s;
}
.my-work-item:hover { transform: scale(1.02); }
.my-work-item img, .my-work-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.my-work-item .text-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 8px;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  text-align: center;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(124,106,255,0.06), rgba(168,85,247,0.04));
}
.my-work-item .delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  background: rgba(0,0,0,0.6);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.my-work-item:hover .delete-btn { display: flex; }
.my-work-item .delete-btn:hover { background: rgba(255,50,50,0.7); }

/* ========== 底部导航 - 毛玻璃浮动风格 ========== */
.bottom-nav {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 680px;
  height: 58px;
  background: rgba(20, 20, 35, 0.75);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-top: none;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 0 8px;
}
.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.3);
  font-size: 10px;
  cursor: pointer;
  padding: 6px 20px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 14px;
  position: relative;
}
.nav-btn.active {
  color: #7c6aff;
  background: rgba(124,106,255,0.1);
}
.nav-btn:hover { color: rgba(255,255,255,0.55); }
.nav-btn svg { width: 22px; height: 22px; transition: transform 0.2s; }
.nav-btn.active svg { transform: scale(1.1); }

/* 发布按钮特殊样式 */
.nav-btn[data-page="publish"] {
  position: relative;
}
.nav-btn[data-page="publish"]::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 16px;
  background: var(--gradient);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: -1;
}
.nav-btn[data-page="publish"]:hover::before,
.nav-btn[data-page="publish"].active::before { opacity: 0.15; }

/* ========== Toast ========== */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: rgba(20,20,35,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #fff;
  padding: 12px 28px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  z-index: 999;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ========== 空状态 ========== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.8;
}

/* ========== 时间格式 ========== */
.time-ago {
  font-size: 11px;
  color: rgba(255,255,255,0.2);
}

/* ========== 确认弹窗 ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-card {
  background: rgba(24, 24, 40, 0.95);
  border-radius: 20px;
  padding: 32px 28px 24px;
  width: 310px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 24px 64px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.06);
  animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modalIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-text {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 26px;
  line-height: 1.5;
}
.modal-actions {
  display: flex;
  gap: 12px;
}
.modal-btn {
  flex: 1;
  padding: 12px 0;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.modal-btn:hover { transform: translateY(-1px); }
.modal-btn:active { transform: scale(0.97); }
.modal-cancel {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.6);
}
.modal-confirm {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 4px 12px rgba(124,106,255,0.3);
}

/* ========== 消息页 ========== */
#msg-page {
  min-height: 100vh;
  padding-bottom: calc(var(--nav-height) + 24px);
  background: var(--bg);
}
.msg-scroll {
  max-width: 720px;
  margin: 0 auto;
}
.msg-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  cursor: pointer;
  transition: background 0.2s;
}
.msg-item:hover { background: rgba(255,255,255,0.02); }
.msg-item.unread {
  background: rgba(124,106,255,0.04);
}
.msg-item.unread .msg-text { color: #fff; }
.msg-item.unread::before {
  content: '';
  position: absolute;
  left: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7c6aff;
}
.msg-item { position: relative; }
.msg-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
}
.msg-content {
  flex: 1;
  min-width: 0;
}
.msg-text {
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  line-height: 1.6;
  word-break: break-all;
}
.msg-text b { color: #fff; font-weight: 600; }
.msg-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.25);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}
.msg-thumb img, .msg-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.msg-follow-btn {
  padding: 7px 16px;
  border: 1.5px solid #7c6aff;
  border-radius: 18px;
  background: transparent;
  color: #7c6aff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.25s;
}
.msg-follow-btn:hover {
  background: rgba(124,106,255,0.12);
  box-shadow: 0 2px 8px rgba(124,106,255,0.15);
}
.msg-follow-btn.following {
  border-color: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.35);
  background: transparent;
}
.msg-read-all-btn:hover { opacity: 0.7; }

/* ========== 导航徽标 ========== */
.nav-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-badge {
  position: absolute;
  top: -5px;
  right: -10px;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  background: linear-gradient(135deg, #ff4d6d, #ff6b6b);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(255,77,109,0.4);
  border: 2px solid rgba(20,20,35,0.8);
}

/* ========== 关注按钮（详情页） ========== */
.follow-btn {
  padding: 7px 18px;
  border: 1.5px solid #7c6aff;
  border-radius: 18px;
  background: transparent;
  color: #7c6aff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  white-space: nowrap;
}
.follow-btn:hover {
  background: rgba(124,106,255,0.12);
  box-shadow: 0 2px 8px rgba(124,106,255,0.15);
}
.follow-btn.following {
  border-color: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.35);
  background: transparent;
  box-shadow: none;
}
/* ========== 连接状态 ========== */
#conn-status {
  position: fixed;
  top: 10px;
  right: 14px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  background: rgba(20,20,35,0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  pointer-events: none;
  transition: opacity 0.3s;
  opacity: 0;
  border: 1px solid rgba(255,255,255,0.06);
}

/* ========== 断线覆盖层 ========== */
#conn-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
}
#conn-overlay > div {
  text-align: center;
  padding: 36px;
  background: rgba(24,24,40,0.9);
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  max-width: 320px;
  width: 90%;
}

/* ========== 关注/粉丝/获赞列表弹窗 ========== */
.list-modal-card {
  width: 420px;
  max-width: 92vw;
  padding: 0;
  text-align: left;
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid var(--border);
}
.modal-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.2s;
}
.modal-close:hover { color: #fff; }
.list-modal-body {
  max-height: 60vh;
  overflow-y: auto;
  padding: 10px 12px;
}
.user-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.user-list-item:hover { background: rgba(255,255,255,0.06); }
.user-list-item img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.user-list-item span {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========== 移动端适配 ========== */
@media (max-width: 768px) {
  /* 首页：手机一行显示两个作品（桌面仍为3列） */
  .waterfall-container {
    grid-template-columns: repeat(2, 1fr);
    padding: 8px 8px 0 8px;
    gap: 8px;
  }
  .wf-card-body { padding: 8px 8px 10px 8px; }
  .wf-card-title { font-size: 12px; margin-bottom: 6px; }
  .wf-card-author img { width: 18px; height: 18px; }
  .wf-card-like svg { width: 13px; height: 13px; }

  /* 登录页 */
  .auth-card { width: 92vw; padding: 32px 22px; }

  /* 顶部栏 */
  .top-bar { padding: 0 10px; }

  /* 底部导航 */
  .bottom-nav { bottom: 8px; width: calc(100% - 20px); height: 54px; }

  /* 个人中心统计更紧凑 */
  .profile-stats { gap: 12px; }
  .stat span:first-child { font-size: 18px; }

  /* 详情页 */
  .detail-scroll { padding-bottom: 90px; }
  .comment-input-bar { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  .comment-input-bar input { font-size: 16px; } /* 防止 iOS 输入缩放 */

  /* 发布页输入框防 iOS 缩放 */
  #pub-title, #pub-desc { font-size: 16px; }

  /* 消息页 */
  .msg-thumb { width: 56px; height: 56px; }

  /* 聊天输入框防 iOS 缩放 */


  /* 连接状态移到不遮挡的位置 */
  #conn-status { top: 8px; right: 10px; }
}

@media (max-width: 400px) {
  .wf-card-media .type-badge { top: 6px; right: 6px; font-size: 9px; padding: 2px 8px; }
  .wf-card-title { -webkit-line-clamp: 1; }
}

/* ========== 多图发布预览 ========== */
.pub-previews {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}
.pub-preview-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--card-border);
}
.pub-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pub-thumb-num {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 8px;
}

/* 首页卡片多图角标 */
.multi-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2;
}

/* 详情页多图横向滑动 */
.detail-gallery {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  background: #0d0d14;
}
.detail-gallery img {
  flex: 0 0 100%;
  scroll-snap-align: center;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  display: block;
}

/* ========== 头像裁剪弹窗 ========== */
.crop-card {
  width: 360px;
  max-width: 92vw;
  padding: 0 0 20px;
  text-align: center;
}
.crop-tip {
  color: rgba(255,255,255,0.45);
  font-size: 12px;
  padding: 10px 20px 0;
}
.crop-stage {
  position: relative;
  width: 280px;
  height: 280px;
  max-width: calc(92vw - 40px);
  max-height: calc(92vw - 40px);
  margin: 14px auto 10px;
  border-radius: 16px;
  overflow: hidden;
  background: #0d0d14;
  border: 1px solid var(--card-border);
  cursor: grab;
  touch-action: none;
}
.crop-stage::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid rgba(124,106,255,0.7);
  border-radius: 16px;
  pointer-events: none;
  box-shadow: inset 0 0 0 100vmax rgba(0,0,0,0);
}
.crop-stage img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 280px;
  transform-origin: center center;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
  will-change: transform;
}
.crop-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 28px;
  color: rgba(255,255,255,0.5);
}
.crop-controls input[type="range"] {
  flex: 1;
  accent-color: #7c6aff;
  height: 4px;
  cursor: pointer;
}
.crop-actions {
  display: flex;
  gap: 12px;
  padding: 10px 24px 0;
}
.crop-actions .modal-btn {
  padding: 11px 0;
}

/* 底部导航 5 项适配 */
.bottom-nav .nav-btn { flex: 1; }

/* 移动端裁剪框缩小 */
@media (max-width: 480px) {
  .crop-stage { width: 260px; height: 260px; }
  .crop-stage img { width: 260px; }
}

/* ========== 视频封面防黑屏 ========== */
/* 视频帧未加载出来时显示渐变背景，避免纯黑 */
.wf-card-media video.need-cover,
.my-work-item video.need-cover,
.msg-thumb video.need-cover {
  background: linear-gradient(160deg, #221540 0%, #16162e 50%, #0d0d1a 100%);
}
/* 播放图标兜底（封面未生成时居中显示） */
.wf-card-media:has(video.need-cover)::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 42px;
  height: 42px;
  margin: -21px 0 0 -21px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E") center/18px no-repeat;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
  z-index: 2;
}
/* 生成 poster 后隐藏播放图标（poster 显示时视频帧就是封面） */
.wf-card-media video.need-cover[poster] ~ .type-badge { z-index: 3; }
.wf-card-media:has(video.need-cover[poster])::after { display: none; }

/* ===== 视频封面图（上传时自动截帧生成，任何浏览器都能显示） ===== */
.video-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 42px;
  height: 42px;
  margin: -21px 0 0 -21px;
  border-radius: 50%;
  background: rgba(0,0,0,0.4) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E") center/18px no-repeat;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
  z-index: 2;
}
.my-work-item .video-play-icon,
.msg-thumb .video-play-icon {
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  background-size: 10px;
}
.msg-thumb .video-play-icon { display: none; } /* 通知小缩略图不显示播放图标 */

/* HEIC 无法预览时显示文件名 */
.pub-preview-fail {
  display: block;
  padding: 8px;
  color: #888;
  font-size: 11px;
  line-height: 1.4;
  word-break: break-all;
  text-align: center;
  background: rgba(255,255,255,0.03);
}
.comment-preview-hint {
  display: inline-block;
  max-width: 120px;
  padding: 10px 6px;
  color: rgba(255,255,255,0.45);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
  border: 1px dashed rgba(255,255,255,0.15);
  border-radius: 10px;
}
