:root {
  --brand-red: #a31f1f;
  --accent-gold: #c8a24a;
  --card-bg: rgba(255, 255, 255, 0.55);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: #f5f0e8;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #2f2520;
}

.page {
  max-width: 375px;
  min-height: 100vh;
  margin: 0 auto;
  background: linear-gradient(rgba(244, 239, 228, 0.95), rgba(244, 239, 228, 0.95)), 
              url("../../小图/微信图片_20260414214619_122_535.jpg") center top / cover no-repeat;
  position: relative;
  overflow-x: hidden;
  padding-bottom: 80px;
}

/* 顶部导航 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--brand-red);
  color: #fff;
}

.topbar-main {
  height: calc(50px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.back-btn {
  font-size: 28px;
  color: #fff;
  text-decoration: none;
  line-height: 1;
}

.topbar h1.centered-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.msg-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  position: relative;
  padding: 4px;
}

.msg-icon {
  font-size: 22px;
}

.msg-badge {
  position: absolute;
  top: -2px;
  right: -6px;
  background: #ff4d4f;
  color: #fff;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* 内容区域 */
.content {
  padding: 12px;
}

/* 发布区域 */
.publish-area {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--card-bg);
  backdrop-filter: blur(5px);
  border-radius: 12px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.publish-area:active {
  background: rgba(255, 255, 255, 0.7);
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a31f1f, #c8a24a);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  flex-shrink: 0;
}

.publish-input {
  flex: 1;
  height: 40px;
  line-height: 40px;
  color: #999;
  font-size: 14px;
}

/* 消息提示条 */
.msg-tip {
  position: fixed;
  top: calc(60px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.tip-close {
  cursor: pointer;
  opacity: 0.7;
  font-size: 16px;
}

.tip-close:hover {
  opacity: 1;
}

/* 帖子列表 */
.posts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-posts {
  text-align: center;
  color: #999;
  padding: 40px 20px;
  font-size: 14px;
}

.post-item {
  background: var(--card-bg);
  backdrop-filter: blur(5px);
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.post-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6b8e23, #c8a24a);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}

.post-avatar.large {
  width: 48px;
  height: 48px;
  font-size: 18px;
}

.post-user-info {
  flex: 1;
}

.post-author {
  font-size: 15px;
  font-weight: 600;
  color: #2f2520;
}

.post-time {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
}

.post-delete-btn {
  background: none;
  border: none;
  color: #999;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.post-delete-btn:active {
  background: rgba(0, 0, 0, 0.05);
  color: #a31f1f;
}

.post-content {
  font-size: 14px;
  line-height: 1.6;
  color: #3d322d;
  margin-bottom: 12px;
  word-break: break-all;
}

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

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

.post-actions {
  display: flex;
  gap: 20px;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* 评论预览 */
.post-comments-preview {
  padding: 8px 0;
  cursor: pointer;
}

.post-comment-item {
  font-size: 13px;
  line-height: 1.6;
  color: #666;
  margin-bottom: 4px;
}

.post-comment-item:last-of-type {
  margin-bottom: 0;
}

.comment-author {
  color: #2f2520;
  font-weight: 500;
}

.comment-text {
  color: #555;
}

.more-comments {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
  padding: 4px 0;
}

.action-btn {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #666;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}

.action-btn:active {
  background: rgba(0, 0, 0, 0.05);
}

.action-btn.liked {
  color: #a31f1f;
}

.action-icon {
  font-size: 18px;
}

.action-count {
  font-size: 13px;
}

/* 底部导航 */
.bottom-tab {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(375px, 100vw);
  height: calc(70px + env(safe-area-inset-bottom));
  background: #f1ebdf;
  border-top: 1px solid #ded5c3;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 6px 2px env(safe-area-inset-bottom);
  z-index: 20;
}

.tab-item {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #8c7e75;
  font-size: 12px;
}

.tab-item.active {
  color: #a31f1f;
}

.tab-item .icon {
  font-size: 24px;
}

/* 模态框 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  z-index: 100;
}

.modal-content {
  background: #fff;
  border-radius: 16px 16px 0 0;
  max-height: 90vh;
  overflow-y: auto;
}

.publish-modal-content {
  max-height: 70vh;
}

.detail-modal-content {
  height: 85vh;
  display: flex;
  flex-direction: column;
}

.msg-modal-content {
  height: 70vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border-bottom: 1px solid #eee;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: #2f2520;
}

.modal-cancel {
  color: #999;
  font-size: 14px;
  cursor: pointer;
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #666;
  cursor: pointer;
}

.modal-publish {
  color: var(--brand-red);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.msg-clear {
  color: #999;
  font-size: 14px;
  cursor: pointer;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
}

/* 发布弹窗内容 */
.publish-textarea {
  width: 100%;
  min-height: 120px;
  border: none;
  resize: none;
  font-size: 15px;
  line-height: 1.6;
  color: #2f2520;
  font-family: inherit;
  outline: none;
}

.publish-textarea::placeholder {
  color: #ccc;
}

.image-upload-area {
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

.upload-btn {
  background: #f5f5f5;
  border: 1px dashed #ddd;
  border-radius: 8px;
  padding: 20px;
  width: 100%;
  color: #999;
  font-size: 14px;
  cursor: pointer;
}

.preview-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.preview-item {
  position: relative;
  width: 80px;
  height: 80px;
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.preview-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* 帖子详情 */
.detail-post {
  padding-bottom: 15px;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 15px;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.detail-content {
  font-size: 15px;
  line-height: 1.7;
  color: #2f2520;
  margin-bottom: 12px;
}

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

.detail-images img {
  width: 100%;
  border-radius: 8px;
  object-fit: cover;
}

.detail-likes {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #666;
  margin-bottom: 15px;
}

.detail-comments {
  padding-top: 10px;
}

.comments-title {
  font-size: 14px;
  font-weight: 600;
  color: #2f2520;
  margin-bottom: 12px;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment-item {
  display: flex;
  gap: 10px;
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6b8e23, #c8a24a);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.comment-info {
  flex: 1;
}

.comment-user {
  font-size: 13px;
  font-weight: 600;
  color: #2f2520;
  margin-bottom: 2px;
}

.comment-content {
  font-size: 14px;
  color: #3d322d;
  line-height: 1.5;
}

.no-comments {
  text-align: center;
  color: #999;
  font-size: 13px;
  padding: 20px 0;
}

/* 评论输入区 */
.detail-comment-area {
  display: flex;
  gap: 10px;
  padding: 12px 15px;
  border-top: 1px solid #eee;
  background: #fff;
}

.comment-input {
  flex: 1;
  height: 40px;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  padding: 0 16px;
  font-size: 14px;
  outline: none;
}

.comment-input:focus {
  border-color: var(--brand-red);
}

.comment-submit {
  background: var(--brand-red);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 0 20px;
  font-size: 14px;
  cursor: pointer;
}

.comment-submit:active {
  opacity: 0.8;
}

/* 消息弹窗 */
.message-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #f5f5f5;
}

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

.msg-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a31f1f, #c8a24a);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}

.msg-info {
  flex: 1;
}

.msg-title {
  margin-bottom: 4px;
}

.msg-user {
  font-size: 14px;
  font-weight: 600;
  color: #2f2520;
}

.msg-action {
  font-size: 14px;
  color: #666;
  margin-left: 4px;
}

.msg-preview {
  font-size: 13px;
  color: #999;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-time {
  font-size: 12px;
  color: #bbb;
}

.no-messages {
  text-align: center;
  color: #999;
  font-size: 14px;
  padding: 60px 20px;
}
