.moments-page {
  --moments-accent: #d4a574;
  background: var(--bg-paper, #fbf6f0);
}

.moments-navbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.moments-toolbar-btn .svg-icon {
  width: 20px;
  height: 20px;
}

.moments-settings-svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.moments-settings-icon {
  display: grid;
  place-items: center;
}

.moments-settings-icon .moments-settings-svg circle {
  fill: currentColor;
  stroke: none;
}

.moments-scroll {
  padding-bottom: calc(88px + var(--safe-bottom, 0px));
}

.moments-cover {
  position: relative;
  min-height: 168px;
  margin: 12px 14px 16px;
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #f3e6d4 0%, #e8d5c0 48%, #d4e4f0 100%);
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.moments-cover-edit {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
}

.moments-cover-avatar {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  border: 3px solid #fffdf8;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1e4d4;
  box-shadow: 0 6px 18px rgba(92, 74, 63, 0.12);
}

.moments-cover-avatar-img,
.moments-cover-avatar-letter {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #5c4a3f;
}

.moments-cover-name {
  margin-top: 10px;
  font-size: 20px;
  font-weight: 700;
  color: #5c4a3f;
}

.moments-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 14px 12px;
}

.moment-post {
  padding: 14px;
}

.moment-post-head {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: center;
}

.moment-post-avatar {
  width: 44px;
  height: 44px;
  border: none;
  padding: 0;
  border-radius: 14px;
  overflow: hidden;
  background: #f1e4d4;
  cursor: pointer;
}

.moment-post-avatar-img,
.moment-post-avatar-letter {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #5c4a3f;
}

.moment-post-name {
  border: none;
  background: none;
  padding: 0;
  text-align: left;
  font-size: 15px;
  font-weight: 700;
  color: #5c4a3f;
  cursor: pointer;
}

.moment-post-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.moment-post-time {
  font-size: 12px;
  color: #a89282;
}

.moment-post-more {
  border: none;
  background: rgba(140, 115, 98, 0.1);
  width: 28px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #8c7362;
}

.moment-post-more .svg-icon {
  width: 16px;
  height: 16px;
}

.moment-post-body {
  margin-top: 10px;
  font-size: 15px;
  line-height: 1.55;
  color: #5c4a3f;
}

.moment-post-text {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.moment-post-body .moment-translate-btn,
.moment-post-body .chat-bubble-translation,
.moment-comment-main .moment-translate-btn,
.moment-comment-main .chat-bubble-translation {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.moment-chat-share {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surface-card, #fffdf8);
}

.moment-chat-share-title {
  font-size: 13px;
  font-weight: 700;
  color: #8c7362;
  margin-bottom: 6px;
}

.moment-chat-share-lines {
  margin: 0;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  color: #5c4a3f;
}

.moment-textimg {
  margin-top: 10px;
  max-width: min(100%, 280px);
}

.moment-textimg-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.moment-textimg-btn:focus-visible {
  outline: 2px solid rgba(140, 115, 98, 0.45);
  outline-offset: 2px;
  border-radius: 12px;
}

.moment-images {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.moment-images.is-single {
  grid-template-columns: 1fr;
  max-width: min(100%, 280px);
}

.moment-images.is-four {
  grid-template-columns: repeat(2, 1fr);
  max-width: 260px;
}

.moment-images.is-grid {
  grid-template-columns: repeat(3, 1fr);
  max-width: 320px;
}

.moment-image-cell {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(120, 100, 85, 0.06);
}

/* 多图：保留方格，但用 contain，横向长图/表情包不再被 cover 裁切放大 */
.moment-images.is-four .moment-image-cell,
.moment-images.is-grid .moment-image-cell {
  aspect-ratio: 1;
}

/* 单图：按原比例完整显示，限制最大宽高，避免横向长图被强制铺满裁切 */
.moment-images.is-single .moment-image-cell {
  aspect-ratio: auto;
  width: fit-content;
  max-width: 100%;
  background: transparent;
}

.moment-image-cell img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  cursor: pointer;
}

.moment-images.is-single .moment-image-cell img {
  width: auto;
  height: auto;
  max-width: min(100%, 280px);
  max-height: 320px;
}

/* 表情包：独立一行，完整 contain，不进九宫格 */
.moment-sticker-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.moment-sticker-chip {
  display: block;
  line-height: 0;
  max-width: 100%;
}

.moment-sticker-chip img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 168px);
  max-height: 168px;
  object-fit: contain;
  object-position: center bottom;
  border: none;
  border-radius: 0;
  background: transparent;
}

/* 正文/评论里的行内表情包：与聊天一致，完整显示 */
.moment-post .chat-sticker-slot,
.moment-post .chat-sticker {
  display: inline-block;
  vertical-align: bottom;
  max-width: 100%;
  line-height: 0;
}

.moment-post .chat-sticker img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 140px);
  max-height: 140px;
  object-fit: contain;
  object-position: center bottom;
}

.moment-image-broken {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  color: #7d6d63;
  font-size: 12px;
  text-align: center;
  background: #f6f2ed;
}

.moment-image-broken[hidden] {
  display: none;
}

.moment-image-retry-wrap,
.moment-image-missing {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  margin-top: 10px;
  padding: 7px 12px;
  border: 1px dashed rgba(140, 115, 98, 0.32);
  border-radius: 10px;
  background: rgba(212, 165, 116, 0.08);
  color: #8c7362;
  font-size: 12px;
}

.moment-image-broken-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.moment-image-broken-actions button {
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid rgba(126, 108, 96, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.moment-image-broken-actions button:last-child {
  color: #745d50;
  border-color: rgba(116, 93, 80, 0.34);
}

.moment-comments {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-card, #fffdf8);
}

.moment-comments.has-content {
  border: 1px dashed rgba(140, 115, 98, 0.16);
}

.moment-comments.is-idle {
  display: none;
  margin-top: 0;
  padding: 0;
}

.moment-comments.is-idle.is-composing {
  display: block;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px dashed rgba(140, 115, 98, 0.16);
}

.moment-comment-compose {
  display: none;
}

.moment-comments.is-composing .moment-comment-compose {
  display: grid;
}

.moment-likes-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #6b5648;
  margin-bottom: 8px;
}

.moment-heart-svg {
  width: 14px;
  height: 14px;
  display: block;
  fill: #e34f5f;
}

.moment-comment-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 4px;
}

.moment-comment-main {
  flex: 1 1 auto;
  min-width: 0;
}

.moment-comment-line {
  display: block;
  width: 100%;
  border: none;
  background: none;
  padding: 0;
  text-align: left;
  font-size: 13px;
  line-height: 1.45;
  color: #5c4a3f;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.moment-comment-line strong {
  color: #6b5648;
}

.moment-comment-reply {
  color: #a89282;
}

.moment-comment-actions {
  display: none;
  align-items: center;
  gap: 2px;
  flex: none;
  padding-top: 1px;
}

.moment-comment-row.is-editing .moment-comment-actions {
  display: flex;
}

.moment-comment-action {
  border: none;
  background: none;
  color: #8f8178;
  font-size: 11px;
  line-height: 1.4;
  cursor: pointer;
  padding: 2px 4px;
}

.moment-comment-del {
  color: #c07070;
}

.moment-comment-compose {
  grid-template-columns: minmax(88px, 0.9fr) 1fr auto;
  gap: 6px;
  margin-top: 10px;
}

.moment-comment-compose .form-input {
  min-height: 36px;
  font-size: 13px;
}

.moments-fab {
  position: fixed;
  right: 18px;
  bottom: calc(18px + var(--safe-bottom, 0px));
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 18px;
  background: linear-gradient(145deg, #f3e6d4, #e8c9a8);
  color: #5c4a3f;
  box-shadow: 0 10px 24px rgba(92, 74, 63, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 40;
}

.moments-fab .svg-icon {
  width: 22px;
  height: 22px;
}

.moments-busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  background: rgba(251, 246, 240, 0.72);
  backdrop-filter: blur(4px);
}

.moments-busy-overlay.is-visible {
  display: flex;
}

.moments-busy-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(140, 115, 98, 0.18);
  border-top-color: #b8956a;
  animation: moments-spin 0.8s linear infinite;
}

.moments-busy-text {
  font-size: 14px;
  color: #6b5648;
}

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

.moments-compose-sheet {
  max-width: 520px;
}

.moments-compose-body .form-label {
  display: block;
  margin: 10px 0 6px;
  font-size: 13px;
  color: #8c7362;
}

.moments-compose-tabs {
  display: flex;
  gap: 8px;
  margin: 12px 0 8px;
}

.moments-compose-tab {
  flex: 1;
  border: 1px dashed rgba(140, 115, 98, 0.22);
  background: #fffdf8;
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 13px;
  color: #8c7362;
  cursor: pointer;
}

.moments-compose-tab.is-active {
  background: #f8eedf;
  border-style: solid;
  color: #5c4a3f;
  font-weight: 600;
}

.moments-compose-pane {
  display: none;
}

.moments-compose-pane.is-active {
  display: block;
}

.moments-compose-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
  max-width: 300px;
}

.moments-compose-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: #f1e4d4;
  border: none;
  padding: 0;
}

.moments-compose-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.moments-compose-cell-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.moments-compose-cell-remove .svg-icon {
  width: 12px;
  height: 12px;
}

.moments-compose-cell-add {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(140, 115, 98, 0.32);
  background: #fffdf8;
  color: #a89282;
  cursor: pointer;
}

.moments-compose-cell-add .svg-icon {
  width: 22px;
  height: 22px;
}

.moments-mention-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  max-height: 120px;
  overflow: auto;
}

.moments-mention-item {
  font-size: 13px;
  color: #5c4a3f;
}

.moments-compose-submit {
  width: 100%;
  margin-top: 14px;
}

.moments-more-sheet {
  max-width: 360px;
}

.moments-backfill-sheet {
  max-width: 380px;
}

.moments-backfill-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 50vh;
  overflow-y: auto;
}

.moments-backfill-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-card, #fffdf8);
  border: 1px solid rgba(140, 115, 98, 0.14);
}

.moments-backfill-row input[type='checkbox'] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--moments-accent, #d4a574);
}

.moments-backfill-row-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.moments-backfill-row-who {
  font-size: 12px;
  font-weight: 600;
  color: #8c7362;
}

.moments-backfill-row-text {
  font-size: 13px;
  color: #5c4a3f;
  line-height: 1.4;
  word-break: break-word;
}

.moments-backfill-row-meta {
  font-size: 11px;
  color: #a08b7a;
}

.moments-more-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.moments-more-identity-label {
  font-size: 12px;
  color: #8c7362;
  margin-bottom: -4px;
}

.moments-more-identity {
  min-height: 36px;
  font-size: 13px;
}

.moments-profile-hero {
  position: relative;
  margin: 12px 14px 16px;
  padding: 16px 16px 16px 96px;
  min-height: 96px;
}

.moments-profile-cover {
  position: absolute;
  inset: 0;
  border: none;
  padding: 0;
  border-radius: inherit;
  background: linear-gradient(120deg, #f3e6d4, #dceaf5);
  background-size: cover;
  background-position: center;
  opacity: 0.55;
  cursor: pointer;
}

.moments-profile-cover.has-image {
  opacity: 1;
}

.moments-profile-cover.has-image::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.28));
}

.moments-profile-avatar {
  position: absolute;
  left: 16px;
  bottom: 16px;
  width: 68px;
  height: 68px;
  border-radius: 16px;
  overflow: hidden;
  border: 3px solid #fffdf8;
  z-index: 1;
}

.moments-profile-name {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 18px;
}

.moments-profile-bio {
  position: relative;
  z-index: 1;
  margin: 6px 0 0;
  font-size: 13px;
  color: #8c7362;
  line-height: 1.45;
}

.moments-profile-sign {
  position: relative;
  z-index: 1;
  display: inline-block;
  margin: 6px 0 0;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 13px;
  color: #8c7362;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
}

.moments-profile-hero .moments-profile-name,
.moments-profile-cover.has-image ~ .moments-profile-name {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.moments-profile-sign.is-empty {
  color: #b8a591;
}
