/* ===== CTYS 分享页面公共样式 ===== */
/* 紫色主题，与官网 index.html 保持一致 */

/* ===== Design Tokens ===== */
:root {
  --primary: #B794F6;
  --primary-light: #F3E8FF;
  --primary-dark: #9F7AEA;
  --primary-glow: rgba(183, 148, 246, 0.12);
  --secondary-pink: #F687B3;
  --bg-page: #FFFFFF;
  --bg-card: #FFFFFF;
  --charcoal: #1A1A1A;
  --gray-800: #2D2D2D;
  --gray-600: #666666;
  --gray-400: #999999;
  --gray-200: #EEEEEE;
  --gray-100: #F5F5F5;
  --danger: #EF4444;
  --success: #22C55E;
  --icon-like: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAAXNSR0IArs4c6QAAA6JJREFUWEfVlz1oFEEUx9/bS+AuSaEkQooUCaQIh567MwgBEQRTRFRQDChooahoZxorBSMoFjaxszhRMWAKRUGFiCksFBWc2TUGFLQ4QTBCckkwRT5uZrwJs8eaXHK3uyfErfbjffz2/2be20XYYAduMB74f4AIIZ0AcAQRe5VSNiI2KaXmEPEbAIxIKYdd1/1YTmFKaRcAnAKAHqVUp/GdAYAviDgqpcy6rvu9nO8qhdLpdFMymbyOiOcAoG69kiqlhhcXF/vHx8d/abtMJtNWV1d3AxGPVlgK80qpbD6fv5DL5eaDtn8B2bbdnkgkngLA1hBr6wciaiV0rJcA0BbC94sQYq/neTnfpwSklUmlUi4A6FL5xyshxGChUHinVejq6mpubGzsVkqdRsSDAbsJc97q39PqIeKQEOKN53kz2rehoaHHKL87YPdNSrlD2+h7JSBCyIOA1PNCiHOe591b620dx9mDiE/0+gja6HUGAH2c8xdr+RJCjiFiFgCSxuYuY+xkCchxnO2WZXl+AClln+u6jypJb9v2TsuyRnwoDSOl7PU8700lX8dxDluW9TCQ09abZFkhSukdADihz4s76gnn/FClgP5zAzWkr6WUx6uB8X0JIfeLu/a4uc4yxs74QD8BYLn+S0tL3WNjY++rBYpjRwihiPjBxJhkjG3BdDrdmkqlNJBWZ4ZzvjlOkrC+hJBpRNyk/RYWFloxk8lsra+v/2QCjTPGtoUNGseeUqp3tm1KbqPpqp+NQjnOeUecBGF9izvua7E9+K2mE9vb25PNzc2/TVcuCCG2+D0hbPCw9rZtb0okEtPGrzA7O9u0vKgJIW8RsdvIdtp13dthg0exp5SeB4BB4/uaMbbLBzqLiLfMgx9CiG3/WiVKaQsA6LXrd/d+xtjNZSBTtq/+HFJKjebz+QMrB18UFcr56HwtLS2PlVK95vnE1NRUh85XGh2U0n0A8MwPUCzhyOTk5KFaQ5WBASHEfs/znuvcf017QshFRLz6r6DKwSilLnHOr5VyrpSUEHIZEQdqDbUGzADn/EqQoewnbK2hqoVZVbIgaa2gwsCsC2T6U6zyhYWpCBQHKgpMVUBRoKLCVA0UBioOTCigaqDiwoQGWg9KP1sxDvQH36o+U2n8RPqVLtcSdKLAbIoEE0kh/w1XQgXfPIoya46OSpKu1zyNSqHLVHF0RIWKo0xNFPKD6L9Yy7LmGGOxf58iLeowCoa13XBAfwBV2CrP6osNLgAAAABJRU5ErkJggg==');
  --icon-collect: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'/%3E%3C/svg%3E");
  --font-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--charcoal);
  background: var(--bg-page);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
}

/* ===== 移动端容器 ===== */
.share-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg-page);
  position: relative;
  padding-bottom: 60px; /* 底部悬浮按钮空间 */
}

/* ===== 用户分享页 - 头部 ===== */
.user-header {
  text-align: center;
  padding: 32px 20px 24px;
  background: var(--bg-card);
}

.user-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  margin: 0 auto 12px;
  object-fit: cover;
}

.user-nickname {
  font-size: 19px;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: 6px;
}

.user-stats {
  font-size: 13px;
  color: var(--gray-400);
  margin-bottom: 18px;
}

.user-stats span {
  margin: 0 4px;
}

.user-header .btn-follow {
  width: calc(100% - 40px);
  max-width: 320px;
  padding: 11px 0;
  font-size: 15px;
}

/* ===== 按钮样式 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 28px;
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 600;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:active {
  background: var(--primary-dark);
  transform: scale(0.97);
}

.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-outline:active {
  background: var(--primary-light);
}

.btn-follow {
  padding: 6px 20px;
  font-size: 13px;
  border-radius: var(--radius-full);
}

.btn-follow.followed {
  background: var(--gray-100);
  color: var(--gray-400);
  border-color: var(--gray-200);
}

/* ===== 底部悬浮下载按钮（胶囊样式，原版风格） ===== */
.bottom-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
}

.bottom-bar .btn {
  pointer-events: auto;
  min-width: 180px;
  padding: 11px 32px;
  font-size: 15px;
  font-weight: 600;
  background: rgba(183, 148, 246, 0.95);
  color: #fff;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 16px rgba(183, 148, 246, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.bottom-bar .btn:active {
  background: rgba(159, 122, 234, 0.95);
  transform: scale(0.97);
}

/* ===== 帖子双列网格（用户分享页） ===== */
.post-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px;
  background: var(--gray-100);
}

.post-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.post-card-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #fff;
}

.post-card-video {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: #000;
  overflow: hidden;
  border-radius: var(--radius-md);
}

.post-card-video img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-card-video .play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.post-card-video .play-icon::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 7px 0 7px 13px;
  border-color: transparent transparent transparent #fff;
  margin-left: 3px;
}

.post-card-body {
  padding: 8px;
}

.post-card-title {
  font-size: 12px;
  font-weight: 400;
  color: var(--charcoal);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
  min-height: 34px;
}

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

.post-card-user {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--gray-400);
  overflow: hidden;
}

.post-card-user img {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.post-card-user span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60px;
}

.post-card-likes {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--gray-400);
}

.post-card-likes .heart-icon {
  width: 12px;
  height: 12px;
  display: inline-block;
  background-image: var(--icon-like);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  vertical-align: middle;
}

/* ===== 帖子详情页 - 图片轮播 ===== */
.carousel {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #fff;
}

.carousel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.carousel-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding-top: 125%; /* 4:3 比例容器 */
  background: #fff;
}

.carousel-slide img,
.carousel-slide video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.carousel-slide video {
  background: #000;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px 0;
  background: #fff;
}

.carousel-dots .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray-200);
  transition: all 0.2s;
}

.carousel-dots .dot.active {
  background: var(--danger);
  width: 6px;
  border-radius: 50%;
}

/* ===== 帖子详情页 - 发帖人信息栏 ===== */
.post-author-bar {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-card);
}

.post-author-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 10px;
  flex-shrink: 0;
}

.post-author-info {
  flex: 1;
  min-width: 0;
}

.post-author-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--charcoal);
}

.post-author-meta {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 1px;
}

/* ===== 帖子详情页 - 内容区 ===== */
.post-detail-content {
  padding: 0 16px 10px;
  background: var(--bg-card);
}

.post-detail-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--charcoal);
  line-height: 1.5;
  margin-bottom: 6px;
}

.post-detail-text {
  font-size: 14px;
  color: var(--gray-800);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.post-detail-topics {
  margin-top: 8px;
}

.post-detail-topics .topic-tag {
  display: inline-block;
  color: var(--primary);
  font-size: 14px;
  margin-right: 8px;
  margin-bottom: 4px;
}

.post-detail-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--gray-100);
}

.post-detail-actions + .comments-section {
  border-top: 1px solid var(--gray-200);
}

.post-detail-actions .action-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--gray-600);
}

.post-detail-actions .action-item .icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  vertical-align: middle;
}

.post-detail-actions .action-item .icon-like {
  background-image: var(--icon-like);
}

.post-detail-actions .action-item .icon-collect {
  background-image: var(--icon-collect);
}

/* ===== 评论区 ===== */
.comments-section {
  background: var(--bg-card);
  padding: 0 16px 16px;
}

.comments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 10px;
}

.comments-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--charcoal);
}

.comments-header .comment-count {
  font-size: 12px;
  color: var(--gray-400);
}

/* 单条评论 */
.comment-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}

.comment-item:last-child {
  border-bottom: none;
}

.comment-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.comment-body {
  flex: 1;
  min-width: 0;
}

.comment-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-800);
  margin-bottom: 3px;
}

.comment-text {
  font-size: 14px;
  color: var(--charcoal);
  line-height: 1.5;
  word-break: break-word;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 5px;
  font-size: 12px;
  color: var(--gray-400);
}

.comment-meta .like-btn {
  display: flex;
  align-items: center;
  gap: 3px;
}

.comment-meta .like-btn .like-icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  background-image: var(--icon-like);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  vertical-align: middle;
}

/* 楼中楼回复（扁平样式，无灰色背景） */
.comment-replies {
  margin-top: 8px;
  margin-left: 38px;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

.reply-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  line-height: 1.5;
  border-top: 1px solid var(--gray-100);
}

.reply-item:first-child {
  border-top: none;
  padding-top: 0;
}

.reply-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.reply-body {
  flex: 1;
  min-width: 0;
}

.reply-user {
  font-weight: 500;
  color: var(--gray-800);
}

.reply-target {
  color: var(--gray-400);
}

.reply-text {
  color: var(--charcoal);
}

.reply-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--gray-400);
}

.reply-meta .like-btn {
  display: flex;
  align-items: center;
  gap: 3px;
}

.reply-meta .like-btn .like-icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  background-image: var(--icon-like);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  vertical-align: middle;
}

/* ===== 话题分享页 ===== */
.topic-header {
  position: relative;
  background: var(--gray-100);
  padding: 12px 12px 0;
}

.topic-header-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.topic-header-card .topic-cover {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
}

.topic-header-card .topic-cover-placeholder {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-light), var(--gray-100));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  flex-shrink: 0;
}

.topic-header-info {
  flex: 1;
  min-width: 0;
}

.topic-header-info .topic-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: 4px;
}

.topic-header-info .topic-stats {
  font-size: 13px;
  color: var(--gray-400);
}

.topic-header-card .btn-follow {
  padding: 5px 16px;
  font-size: 13px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Tab 切换 */
.tab-bar {
  display: flex;
  justify-content: center;
  background: var(--gray-100);
  border-bottom: none;
  padding: 6px 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.tab-item {
  flex: 0 0 auto;
  text-align: center;
  padding: 10px 24px;
  font-size: 14px;
  color: var(--gray-400);
  position: relative;
  transition: color 0.2s;
}

.tab-item.active {
  color: var(--charcoal);
  font-weight: 500;
}

.tab-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

/* 话题帖子列表（单列） */
.topic-post-list {
  padding: 6px 0 0;
  background: var(--gray-100);
}

.topic-post-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px;
  margin: 0 12px 12px;
  box-shadow: var(--shadow-md);
}

.topic-post-card .post-user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.topic-post-card .post-user-row img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

.topic-post-card .post-user-row .name {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-800);
}

.topic-post-card .post-user-row .time {
  font-size: 11px;
  color: var(--gray-400);
  margin-left: auto;
}

.topic-post-card .post-text {
  font-size: 14px;
  color: var(--charcoal);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.topic-post-card .post-images {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin-bottom: 8px;
}

.topic-post-card .post-images img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #fff;
  border-radius: 8px;
}

.topic-post-card .post-actions-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  font-size: 12px;
  color: var(--gray-400);
}

.topic-post-card .post-actions-row .action {
  display: flex;
  align-items: center;
  gap: 3px;
}

.topic-post-card .post-actions-row .action .like-icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  background-image: var(--icon-like);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  vertical-align: middle;
}

.topic-post-card .post-actions-row .action .collect-icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  background-image: var(--icon-collect);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  vertical-align: middle;
}

/* ===== 协议页面 ===== */
.agreement-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  background: var(--bg-card);
  min-height: 100vh;
}

.agreement-content {
  font-size: 15px;
  color: var(--gray-800);
  line-height: 1.8;
}

.agreement-content p {
  margin-bottom: 12px;
}

.agreement-content h1,
.agreement-content h2,
.agreement-content h3 {
  margin-top: 20px;
  margin-bottom: 10px;
  color: var(--charcoal);
}

.agreement-content h2 {
  font-size: 18px;
  padding-bottom: 6px;
}

.agreement-content h3 {
  font-size: 16px;
}

.agreement-content ul,
.agreement-content ol {
  padding-left: 24px;
  margin-bottom: 12px;
}

.agreement-content li {
  margin-bottom: 6px;
}

.agreement-content a {
  color: var(--primary);
  text-decoration: underline;
}

.agreement-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

.agreement-content table th,
.agreement-content table td {
  border: 1px solid var(--gray-200);
  padding: 8px 10px;
  text-align: left;
}

.agreement-content table th {
  background: var(--gray-100);
  font-weight: 600;
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 14px;
}

/* ===== 加载状态 ===== */
.loading-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-400);
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

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

/* ===== 错误状态 ===== */
.error-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-600);
}

.error-state .error-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.error-state p {
  font-size: 14px;
  margin-bottom: 16px;
}

.error-state .btn {
  font-size: 14px;
  padding: 8px 24px;
}

/* ===== 回到顶部 ===== */
.back-to-top {
  position: fixed;
  bottom: 80px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--gray-600);
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:active {
  transform: scale(0.9);
}

