/* ==================== 墨竹 社交论坛 - 样式系统 ==================== */

:root {
  --theme-color: #00BFA5;
  --theme-color-rgb: 0, 191, 165;
  --theme-color-light: rgba(0, 191, 165, 0.1);
  --theme-color-hover: rgba(0, 191, 165, 0.2);
}

[data-theme="light"] {
  color-scheme: light;
  --bg-primary: #ffffff;
  --bg-secondary: #f7f7f7;
  --bg-tertiary: #f0f0f0;
  --bg-elevated: #ffffff;
  --bg-input: #f7f7f7;
  --bg-page: #f5f5f5;
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-tertiary: #999999;
  --border-color: #ececec;
  --border-light: #f0f0f0;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 2px 12px rgba(0, 0, 0, 0.06);
  --glass-bg: rgba(255, 255, 255, 0.92);
  --modal-overlay: rgba(0, 0, 0, 0.35);
  --danger: #ff2442;
  --warning: #ff9500;
  --success: #00b877;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg-primary: #141414;
  --bg-secondary: #1c1c1c;
  --bg-tertiary: #242424;
  --bg-elevated: #1c1c1c;
  --bg-input: #1c1c1c;
  --bg-page: #0f0f0f;
  --text-primary: #f1f1f1;
  --text-secondary: #aaaaaa;
  --text-tertiary: #777777;
  --border-color: #2a2a2a;
  --border-light: #1f1f1f;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 2px 12px rgba(0, 0, 0, 0.4);
  --glass-bg: rgba(20, 20, 20, 0.92);
  --modal-overlay: rgba(0, 0, 0, 0.6);
  --danger: #ff4d6a;
  --warning: #ffb340;
  --success: #34d399;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-page, var(--bg-primary));
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}

body {
  min-height: 100vh;
  padding-bottom: 56px;
}

@media (min-width: 768px) {
  body { padding-bottom: 0; }
}

a { color: var(--theme-color); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }
img { display: block; max-width: 100%; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

.icon { width: 22px; height: 22px; display: inline-block; flex-shrink: 0; color: var(--text-primary); }
.icon-sm { width: 18px; height: 18px; }
.icon-lg { width: 26px; height: 26px; }
.icon-xl { width: 32px; height: 32px; }
.btn .icon { color: currentColor; }

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  display: none;
  align-items: center;
  padding: 0 12px;
  gap: 10px;
}

.top-bar.show { display: flex; }

.top-bar .logo {
  font-weight: 800;
  font-size: 20px;
  color: var(--theme-color);
  white-space: nowrap;
}

.top-bar .search-box {
  flex: 1;
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 16px;
  cursor: pointer;
}

.top-bar .search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
}
.top-bar .search-box input::placeholder { color: var(--text-tertiary); }

.top-bar .actions { display: flex; gap: 8px; align-items: center; }

.top-bar .icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--danger);
  color: #fff;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  z-index: 100;
  display: none;
  justify-content: space-around;
  align-items: center;
}

.bottom-nav.show { display: flex; }

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 12px;
  color: var(--text-tertiary);
  font-size: 11px;
  transition: color 0.2s;
  position: relative;
  flex: 1;
  max-width: 80px;
}

.nav-item.active { color: var(--theme-color); }
.nav-item:active { transform: scale(0.92); }

.nav-item .icon { width: 24px; height: 24px; }

.nav-item.post-btn .icon {
  width: 40px;
  height: 40px;
  background: var(--theme-color);
  color: #fff;
  border-radius: 50%;
  padding: 8px;
  margin-bottom: 0;
}

#app-content {
  min-height: 100vh;
  padding-top: 0;
}

.page {
  padding-top: 52px;
  max-width: 100%;
  margin: 0 auto;
  min-height: 100vh;
}

.page.no-topbar { padding-top: 0; }
.page.fullscreen { max-width: 100%; padding-top: 0; }

@media (min-width: 768px) {
  .page { padding-top: 0; max-width: 1280px; padding-left: 20px; padding-right: 20px; }
  #app-content { margin-left: 220px; }
  #top-bar { display: none !important; }
  #bottom-nav { display: none !important; }
}

@media (min-width: 768px) {
  body.auth-view #app-content { margin-left: 0; }
  body.auth-view #side-nav { display: none; }
  body.shorts-view #app-content { margin-left: 0; }
  body.shorts-view #side-nav { display: none; }
}

.avatar {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.avatar-sm { width: 32px; height: 32px; }
.avatar-md { width: 48px; height: 48px; border-radius: 10px; }
.avatar-xs { width: 20px; height: 20px; }
.avatar-lg { width: 64px; height: 64px; }
.avatar-xl { width: 80px; height: 80px; }

.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--theme-color);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}

.feed-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 8px;
}

.feed-grid.masonry-grid {
  display: block;
  column-count: 2;
  column-gap: 10px;
  padding: 10px;
  max-width: 100%;
}

.masonry-grid .feed-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 10px;
  vertical-align: top;
  break-inside: avoid;
}

.feed-card {
  background: var(--bg-elevated);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s;
  break-inside: avoid;
  border: 1px solid var(--border-light);
}

.feed-card:active { transform: scale(0.98); }

.feed-card .cover {
  width: 100%;
  aspect-ratio: 3/4;
  background: var(--bg-tertiary);
  overflow: hidden;
  position: relative;
}

.feed-card .cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.feed-card .cover-ph {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
}

.feed-card .card-body { padding: 8px 10px; }

.feed-card .card-title {
  font-size: 13px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}

.feed-card .card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-tertiary);
}

.feed-card .card-author {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 60%;
}

.feed-card .card-author span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xhs-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .16s, box-shadow .16s;
}
.xhs-card:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(0,0,0,.14); }
.xhs-card .cover { position: relative; background: var(--bg-secondary); overflow: hidden; }
.xhs-card .cover img { width: 100%; display: block; background: var(--bg-secondary); }
.xhs-card .cover-ph {
  width: 100%; aspect-ratio: 3/4; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; color: var(--text-tertiary); background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
  font-size: 13px; padding: 18px; text-align: center;
}
.xhs-card .cover-ph .icon { width: 30px; height: 30px; }
.xhs-card .card-body { padding: 9px 10px 11px; }
.xhs-title {
  font-size: 14px; line-height: 1.4; font-weight: 600; color: var(--text-primary);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.xhs-foot { margin-top: 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.xhs-author { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-secondary); min-width: 0; }
.xhs-author span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.shorts-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 56px;
  background: #000;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
}

.shorts-container::-webkit-scrollbar { display: none; }

.short-item {
  height: calc(100vh - 56px);
  scroll-snap-align: start;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.short-item .short-player {
  width: 100%;
  height: 100%;
}

.short-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 60px 16px 16px;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  color: #fff;
  pointer-events: none;
}

.short-overlay > * { pointer-events: auto; }

.short-author {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.short-author .avatar {
  border: 2px solid #fff;
}

.short-desc {
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 4px;
}

.short-actions {
  position: absolute;
  right: 12px;
  bottom: 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.short-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: #fff;
  cursor: pointer;
  user-select: none;
  min-width: 52px;
}
.short-action:active { transform: scale(0.92); }

.short-action .icon { width: 24px; height: 24px; }

.short-detail-page { max-width: 920px; margin: 0 auto; padding: 12px; }
.video-player-wrap { background: #000; border-radius: 12px; overflow: hidden; text-align: center; }
.video-player-wrap #player-detail { width: 100%; aspect-ratio: 16/9; }

.page-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}

.page-head h2 { font-size: 18px; font-weight: 700; }

.video-meta { padding: 14px 4px 0; }
.video-author { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.video-author span { font-weight: 700; }
.video-actions { display: flex; gap: 22px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-color); }
.video-actions button { display: flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 20px; background: var(--bg-secondary); }

.profile-header { position: relative; margin-bottom: 0; }
.profile-bg { width: 100%; height: 200px; background: var(--theme-color); position: relative; overflow: hidden; }
.profile-bg img { width: 100%; height: 100%; object-fit: cover; }
.profile-info { padding: 0 16px; position: relative; }
.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid var(--bg-primary);
  margin-top: -40px;
  position: relative;
  z-index: 2;
  background: var(--bg-tertiary);
  object-fit: cover;
}
.profile-info h2 { font-size: 20px; font-weight: 700; margin-top: 8px; }
.profile-id { font-size: 14px; color: var(--text-tertiary); }
.profile-bio { font-size: 14px; color: var(--text-secondary); margin-top: 8px; line-height: 1.5; }
.profile-stats { display: flex; gap: 20px; margin-top: 12px; font-size: 14px; }
.profile-stats span { color: var(--text-secondary); }
.profile-actions { display: flex; gap: 8px; margin-top: 12px; }

.btn {
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--theme-color);
  color: #fff;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: scale(0.97); }

.btn-ghost {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.btn-ghost:hover { background: var(--border-color); }

.btn-block { width: 100%; justify-content: center; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn-sm { padding: 6px 14px; font-size: 13px; }

.input-group { margin-bottom: 16px; }
.input-label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 600; }
.input, .textarea, .select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--theme-color); }
.textarea { resize: vertical; min-height: 80px; }

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-primary);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elevated);
  border-radius: 16px;
  padding: 32px 24px;
  box-shadow: var(--shadow-lg);
}

.google-card { box-shadow: 0 1px 3px rgba(0,0,0,0.05); border: 1px solid var(--border-color); }
.auth-brand { text-align: center; margin-bottom: 24px; }
.brand-logo { font-size: 28px; font-weight: 800; color: var(--theme-color); }
.brand-sub { font-size: 14px; color: var(--text-tertiary); margin-top: 4px; }
.auth-h { font-size: 22px; font-weight: 800; }
.auth-sub { font-size: 13px; color: var(--text-tertiary); margin: 4px 0 20px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; font-size: 13px; }
.auth-link { color: var(--theme-color); cursor: pointer; user-select: none; white-space: nowrap; }
.auth-link:hover { text-decoration: underline; }
.auth-copy { margin-top: 20px; font-size: 12px; color: var(--text-tertiary); text-align: center; }

.captcha-row { display: flex; align-items: center; gap: 8px; }
.captcha-img { height: 40px; width: 100px; border-radius: 8px; border: 1px solid var(--border-color); cursor: pointer; background: var(--bg-secondary); flex-shrink: 0; }

.oobe-card { max-width: 440px; padding: 22px 24px 18px; display: flex; flex-direction: column; max-height: 92vh; }
.oobe-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.brand-title-sm { font-size: 16px; font-weight: 700; }
.oobe-steps { display: flex; gap: 4px; padding: 0 16px 12px; }
.oobe-step-dot { flex: 1; height: 4px; border-radius: 2px; background: var(--border-color); transition: background 0.3s; }
.oobe-step-dot.active { background: var(--theme-color); }
#oobe-body { overflow-y: auto; padding: 10px 2px 4px; flex: 1; }
.oobe-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-color); }
.oobe-title { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.oobe-sub { font-size: 14px; color: var(--text-tertiary); margin-bottom: 24px; }

.avatar-gallery { display: flex; justify-content: center; margin-bottom: 20px; }
.avatar-opt { border-radius: 50%; border: 2px solid transparent; padding: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; background: var(--bg-secondary); transition: all .15s; }
.avatar-opt img, .avatar-opt .avatar, .avatar-opt .avatar-default { border-radius: 50%; width: 96px; height: 96px; object-fit: cover; }
.avatar-opt.selected { border-color: var(--theme-color); background: var(--theme-color-light); }
.avatar-opt-upload { flex-direction: column; gap: 8px; border-radius: 20px; padding: 10px; }
.avatar-upload-inner { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text-secondary); }
.avatar-upload-inner .icon { width: 28px; height: 28px; }
.avatar-upload-hint { font-size: 12px; color: var(--text-tertiary); }

.theme-mode-row { display: flex; gap: 12px; margin-bottom: 18px; }
.theme-mode-opt { flex: 1; border: 2px solid var(--border-color); border-radius: 12px; padding: 12px; text-align: center; cursor: pointer; background: var(--bg-secondary); transition: all .15s; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.theme-mode-opt.selected { border-color: var(--theme-color); color: var(--text-primary); }
.tm-preview { height: 60px; border-radius: 8px; margin-bottom: 8px; border: 1px solid var(--border-color); }
.tm-preview.dark { background: linear-gradient(135deg,#1f1f25,#2c2c34); }
.tm-preview.light { background: linear-gradient(135deg,#ffffff,#f0f0f3); }
.color-swatches { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 6px; }
.color-swatch { width: 36px; height: 36px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; box-shadow: 0 1px 4px rgba(0,0,0,.2); transition: transform .12s; }
.color-swatch:hover { transform: scale(1.08); }
.color-swatch.selected { border-color: #fff; outline: 2px solid var(--text-primary); }

.oobe-toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; gap: 12px; }
.ot-label { font-size: 15px; font-weight: 600; }
.ot-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: var(--bg-tertiary); border-radius: 26px; transition: .2s; }
.slider::before { content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + .slider { background: var(--theme-color); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.bind-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 14px; }
.bind-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-secondary); cursor: pointer; font-size: 14px; transition: all .15s; }
.bind-item.on { border-color: var(--theme-color); background: var(--theme-color-light); color: var(--theme-color); }
.bind-item i { margin-left: auto; font-style: normal; font-size: 12px; color: var(--text-tertiary); }

.welcome-page { position: relative; min-height: 100vh; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--bg-primary); }
.welcome-inner { position: relative; z-index: 2; text-align: center; padding: 32px; max-width: 360px; }
.welcome-logo { font-size: 42px; font-weight: 800; letter-spacing: 4px; color: var(--theme-color); margin-bottom: 28px; line-height: 1; user-select: none; }
.welcome-title { font-size: 28px; font-weight: 700; margin: 0; display: inline; }
.welcome-name { font-size: 28px; font-weight: 700; color: var(--theme-color); margin: 0; display: inline; }
.welcome-sub { font-size: 15px; color: var(--text-secondary); margin: 16px 0 32px; }

.confetti { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.confetti-piece { position: absolute; top: -20px; width: 7px; height: 11px; border-radius: 2px; opacity: .55; animation-name: confetti-fall; animation-timing-function: linear; animation-iteration-count: 1; animation-fill-mode: forwards; }
@keyframes confetti-fall { 0% { transform: translateY(-20px) rotate(0deg); opacity: 0; } 10% { opacity: .55; } 90% { opacity: .45; } 100% { transform: translateY(105vh) rotate(720deg); opacity: 0; } }

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--modal-overlay);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s;
}

.modal {
  background: var(--bg-elevated);
  border-radius: 16px;
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-body { padding: 16px; }
.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

#toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  animation: slideUp 0.3s;
  white-space: nowrap;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-tertiary);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top-color: var(--theme-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-tertiary);
}
.empty-state .icon { width: 48px; height: 48px; margin-bottom: 12px; color: var(--border-color); }

.side-nav {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 220px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  flex-direction: column;
  padding: 16px 12px;
  z-index: 90;
  overflow-y: auto;
}

@media (min-width: 768px) {
  .side-nav { display: flex; }
}

@media (max-width: 767px) {
  .side-nav.open {
    display: flex;
    width: 260px;
    max-width: 82vw;
    background: var(--bg-primary);
    box-shadow: 2px 0 16px rgba(0,0,0,0.25);
    padding: 16px 12px;
  }
}

.side-nav-logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--theme-color);
  letter-spacing: 0.5px;
  padding: 8px 12px 20px;
  display: block;
}

.side-nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
}

.side-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.side-nav-item:hover { background: var(--bg-secondary); }
.side-nav-item.active { color: var(--theme-color); font-weight: 700; }
.side-nav-item .icon { width: 20px; height: 20px; flex-shrink: 0; }

.side-nav-post {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 4px 8px 8px;
  padding: 12px 16px;
  background: var(--theme-color);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  transition: filter 0.2s, transform 0.15s;
}
.side-nav-post:hover { filter: brightness(1.05); }
.side-nav-post:active { transform: scale(0.97); }
.side-nav-post .icon { width: 20px; height: 20px; color: currentColor; }

.side-nav-more { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border-light); }
.side-nav-more .side-nav-item { font-size: 14px; color: var(--text-secondary); }

.side-nav-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  margin-top: 8px;
}
.side-nav-profile:hover { background: var(--bg-secondary); }
.side-nav-profile-info { min-width: 0; }
.side-nav-profile-name { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav-profile-id { font-size: 12px; color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.online-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--bg-primary);
  position: absolute;
  bottom: 0;
  right: 0;
}
.online-dot.offline { background: var(--text-tertiary); }

.avatar-wrapper { position: relative; display: inline-block; align-self: flex-start; flex-shrink: 0; line-height: 0; }

.route-error { max-width: 420px; margin: 80px auto; text-align: center; padding: 30px; }
.route-error-icon { color: var(--theme-color); margin-bottom: 12px; }
.route-error h2 { font-size: 20px; margin-bottom: 8px; }
.route-error p { color: var(--text-tertiary); margin-bottom: 20px; }
.route-error-actions { display: flex; gap: 12px; justify-content: center; }

.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-tertiary { color: var(--text-tertiary); }
.text-secondary { color: var(--text-secondary); }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

/* ==================== 侧边导航 ==================== */
.side-nav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 220px;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
}

@media (max-width: 767px) {
  .side-nav { transform: translateX(-100%); }
  .side-nav.open { transform: translateX(0); }
}

.side-nav-header {
  padding: 16px 14px 12px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
}

.side-nav-logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--theme-color);
  letter-spacing: -0.5px;
}

.side-nav-user {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.side-nav-user:hover { background: var(--bg-secondary); }
.side-nav-user-info { flex: 1; min-width: 0; }
.side-nav-user-name { font-size: 14px; font-weight: 700; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav-user-role { font-size: 11px; color: var(--text-tertiary); }

.side-nav-search {
  padding: 10px 14px;
}

.side-nav-search input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.side-nav-search input:focus { border-color: var(--theme-color); }
.side-nav-search input::placeholder { color: var(--text-tertiary); }

.side-nav-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.side-nav-section {
  padding: 8px 14px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.side-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 0;
  border-left: 3px solid transparent;
}
.side-nav-item:hover { background: var(--bg-secondary); color: var(--text-primary); border-left-color: var(--theme-color); }
.side-nav-item.active { background: var(--theme-color-light); color: var(--theme-color); border-left-color: var(--theme-color); font-weight: 700; }
.side-nav-item .icon { width: 20px; height: 20px; flex-shrink: 0; }
.side-nav-item .badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px; }

.side-nav-divider {
  height: 1px;
  background: var(--border-color);
  margin: 8px 14px;
}

.side-nav-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border-color);
}

.side-nav-post {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: var(--theme-color);
  color: #fff;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s;
  border: none;
}
.side-nav-post:hover { filter: brightness(1.1); }
.side-nav-post:active { transform: scale(0.97); }
.side-nav-post .icon { width: 20px; height: 20px; }

/* ==================== 侧边栏面板（登录/扫码/表情/评论输入） ==================== */
.side-panel-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.side-panel-overlay.show { opacity: 1; pointer-events: auto; }

.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  background: var(--bg-primary);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
}
.side-panel.show { transform: translateX(0); }
.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.side-panel-title { font-size: 16px; font-weight: 700; }
.side-panel-body { flex: 1; overflow-y: auto; padding: 12px; }

/* ==================== 模态框 ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg-elevated);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.92) translateY(20px);
  transition: transform 0.2s;
  box-shadow: var(--shadow-lg);
}
.modal-overlay.show .modal { transform: scale(1) translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%; background: var(--bg-tertiary); color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; cursor: pointer; border: none; transition: background .15s;
}
.modal-close:hover { background: var(--border-color); }
.modal-body { flex: 1; overflow-y: auto; padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-shrink: 0;
}
.modal-fullscreen { max-width: 100vw; max-height: 100vh; border-radius: 0; }
.modal-sm { max-width: 360px; }

/* ==================== 通知提示 ==================== */
.toast-container {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  animation: toastIn 0.2s ease;
  max-width: 320px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--theme-color); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ==================== 通用工具类 ==================== */
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; }
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--border-color);
  border-top-color: var(--theme-color); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-tertiary); }
.empty-state .icon { width: 48px; height: 48px; margin: 0 auto 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

.text-muted { color: var(--text-tertiary); }
.text-center { text-align: center; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.hidden { display: none !important; }
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
