/* 主题 */
:root[data-theme="dark"] {
  --ink: #edf0ed;
  --muted: #acb6b0;
  --paper: #171b1d;
  --card: #202629;
  --line: #343b3d;
  --accent: #e3a879;
  --accent2: #9db7a0;
  --soft: #2b3334;
  --shadow: 0 16px 45px rgba(0, 0, 0, .28)
}

:root[data-theme="dark"] .header {
  background: rgba(23, 27, 29, .92)
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select {
  background: #202629;
  color: var(--ink)
}

:root[data-theme="dark"] .dialog {
  background: var(--paper)
}

:root[data-theme="dark"] .hero {
  background: radial-gradient(circle at 12% 20%, #3e342d, transparent 35%), radial-gradient(circle at 90% 80%, #293b35, transparent 36%), #1e2426
}

:root[data-theme="dark"] .hero .eyebrow {
  color: #d7ab88
}

:root[data-theme="dark"] .hero>p:not(.eyebrow) {
  color: #b6c0bb
}

.theme-toggle {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--card);
  color: var(--ink);
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px
}

/* 评论、留言 */
.comment-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  text-align: left;
  padding: 17px 0
}

.comment-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--soft)
}

.fallback-avatar {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 800
}

.comment-body {
  min-width: 0;
  flex: 1;
  padding-right: 8px
}

.comment-body p {
  margin: 5px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere
}

.comment-row .comment-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px
}

.comment-row .comment-head span {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap
}

.comments {
  margin-top: 32px
}

.comments h3 {
  margin-bottom: 4px
}

.comments form {
  margin-top: 22px;
  padding: 18px;
  border-radius: 13px;
  background: var(--soft)
}

.comment-panel {
  padding-left: 24px;
  padding-right: 24px
}

.delete-comment {
  font-size: 12px;
  color: #b54b40
}

/* 音乐 */
.music-widget {
  overflow: hidden;
  position: relative
}

.music-widget:before {
  content: "";
  position: absolute;
  width: 130px;
  height: 130px;
  right: -65px;
  top: -65px;
  border-radius: 50%;
  background: radial-gradient(circle, #f4d8b4 0 12%, #3e4746 13% 44%, #e9ba91 45% 48%, transparent 49%);
  opacity: .45;
  animation: musicPulse 4s ease-in-out infinite
}

.music-art {
  position: relative;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 29px;
  color: #fff;
  background: radial-gradient(circle, #d8a47e 0 13%, #1e2429 14% 56%, #69736e 57% 60%, #1e2429 61%);
  animation: spin 11s linear infinite;
  margin: 15px auto 5px
}

.music-art img {
  width: 100%;
  height: 100%;
  object-fit: cover
}

.music-widget .track-name,
.music-widget .meta {
  text-align: center;
  position: relative
}

.music-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 13px 0 2px;
  position: relative
}

.music-controls button {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  cursor: pointer;
  transition: .2s
}

.music-controls button:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  color: var(--accent)
}

.music-controls .music-play {
  width: 43px;
  height: 43px;
  background: var(--accent);
  color: #fff;
  border: 0;
  box-shadow: 0 7px 16px #a9603845
}

.music-controls.large {
  justify-content: flex-start;
  margin: 22px 0
}

.music-controls.large button {
  border-radius: 10px;
  width: auto;
  height: auto;
  padding: 10px 14px
}

.music-controls.large .music-play {
  padding: 11px 18px
}

@keyframes musicPulse {
  50% {
    transform: scale(1.15);
    opacity: .2
  }
}

.mini-playlist {
  display: grid;
  gap: 2px;
  margin-top: 10px;
  max-height: 115px;
  overflow: auto;
  position: relative
}

.mini-playlist button {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 7px 2px;
  text-align: left;
  cursor: pointer;
  font-size: 12px
}

.mini-playlist button:hover {
  color: var(--accent)
}

.mini-playlist small {
  color: var(--muted);
  white-space: nowrap
}

/* 生活九宫格 */
.life-gallery-section {
  padding: 0 0 55px
}

.moment-list {
  display: grid;
  gap: 22px
}

.life-moment {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow)
}

.moment-text {
  margin: 0 0 14px;
  white-space: pre-wrap
}

.life-moment>.meta {
  margin: 11px 0 0
}

.life-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px
}

.life-photo {
  border: 0;
  padding: 0;
  position: relative;
  aspect-ratio: 1/1;
  overflow: hidden;
  border-radius: 9px;
  background: var(--soft);
  cursor: zoom-in
}

.life-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s
}

.life-photo:hover img {
  transform: scale(1.08)
}

.photo-dialog {
  width: min(1000px, 96vw);
  padding: 20px;
  background: #101315;
  color: #fff
}

.photo-dialog img {
  display: block;
  max-width: 100%;
  max-height: 78vh;
  margin: auto;
  object-fit: contain
}

.photo-dialog p {
  margin: 12px 0 0;
  text-align: center;
  color: #e2e5e3
}

/* 富文本和附件 */
.rich-content pre {
  overflow: auto;
  padding: 16px;
  border-radius: 12px;
  background: #172126;
  color: #e9f0ee;
  line-height: 1.55
}

.rich-content code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace
}

.rich-content mark {
  padding: 1px 4px;
  border-radius: 3px;
  background: #ffe4a9
}

.rich-content blockquote {
  margin: 20px 0;
  padding: 8px 18px;
  border-left: 4px solid var(--accent);
  background: var(--soft);
  color: var(--muted)
}

.attachment-link {
  display: inline-flex;
  margin: 8px 0 16px;
  padding: 9px 13px;
  border: 1px dashed var(--accent);
  border-radius: 9px;
  color: var(--accent)
}

.life-article-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 22px 0
}

.life-article-gallery .life-photo {
  border-radius: 10px
}

/* 二次确认 */
.confirm-dialog {
  width: min(430px, 100%)
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 25px
}

.danger-button {
  background: #b84c44 !important
}

.message-layout .comment-panel {
  display: flex;
  flex-direction: column
}

.message-layout .comment-panel>h2 {
  flex: 0 0 auto;
  padding: 0 0 8px;
  margin: 0
}

.message-layout .message-list {
  height: 380px;
  overflow-y: auto;
  padding-right: 4px
}

.message-layout .message-list::-webkit-scrollbar {
  width: 6px
}

.message-layout .message-list::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 3px
}

.timeline-list {
  position: relative;
  padding-left: 24px
}

.timeline-list:before {
  content: "";
  position: absolute;
  left: 5px;
  top: 9px;
  bottom: 9px;
  width: 2px;
  background: var(--line)
}

.timeline-list .post-card {
  position: relative
}

.timeline-list .post-card:before {
  content: "";
  position: absolute;
  z-index: 1;
  left: -27px;
  top: 28px;
  width: 10px;
  height: 10px;
  border: 3px solid var(--paper);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent)
}

/* 两栏布局时禁用时间轴竖线和圆点 */
@media (min-width: 721px) {
  .timeline-list {
    padding-left: 0;
  }
  .timeline-list:before {
    display: none;
  }
  .timeline-list .post-card:before {
    display: none;
  }
}

@media(max-width:720px) {
  .theme-toggle {
    font-size: 0;
    width: 34px;
    height: 34px;
    padding: 0
  }

  .theme-toggle:first-letter {
    font-size: 16px
  }

  .life-grid {
    gap: 7px
  }

  .comment-row {
    gap: 10px
  }

  .comment-avatar {
    width: 36px;
    height: 36px;
    flex-basis: 36px
  }

  .comment-head {
    align-items: flex-start !important;
    flex-direction: column;
    gap: 0 !important
  }

  .music-controls.large {
    flex-wrap: wrap
  }

  .music-controls.large button {
    flex: 1
  }

  .life-photo span {
    opacity: 1
  }
}

/* 回复功能 */
.comment-actions {
  display: flex;
  gap: 14px;
  margin-top: 6px;
  flex-wrap: wrap
}

.comment-actions .text-button {
  font-size: 12px;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer
}

.reply-btn {
  color: var(--accent)
}

.reply-btn:hover {
  text-decoration: underline
}

.reply-form-wrap {
  margin-top: 10px
}

.reply-form {
  padding: 12px;
  border-radius: 10px;
  background: var(--soft);
  border: 1px solid var(--line)
}

.reply-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  resize: vertical;
  font-family: inherit;
  box-sizing: border-box
}

.reply-form label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px
}

.reply-form label input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  margin-top: 4px;
  box-sizing: border-box
}

.reply-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
  align-items: center
}

.reply-form-actions .button {
  padding: 6px 14px;
  font-size: 13px
}

.reply-form-actions .plain {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px
}

.reply-hint {
  display: block;
  font-size: 12px;
  color: #b54b40;
  margin-top: 4px
}

.replies {
  margin-top: 10px;
  margin-left: 20px;
  padding-left: 14px;
  border-left: 2px solid var(--line)
}

.reply-item {
  padding: 10px 0
}

.reply-item .comment-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  font-size: 13px
}

.reply-item .comment-head {
  flex-wrap: wrap;
  gap: 6px
}

.reply-to {
  color: var(--accent);
  font-size: 12px
}

@media(max-width:720px) {
  .replies {
    margin-left: 10px;
    padding-left: 10px
  }
}

/* 弹窗层级：登录框始终在最上层 */
#authModal {
  z-index: 30
}

/* 用户信息弹窗 */
.user-info-dialog {
  max-width: 380px;
  width: 100%
}

.user-info-content {
  padding: 10px 0
}

.user-info-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px
}

.user-info-avatar .comment-avatar {
  width: 64px;
  height: 64px;
  font-size: 28px
}

.user-info-basic {
  flex: 1
}

.user-info-name {
  margin: 0 0 6px 0;
  font-size: 20px
}

.user-info-tag {
  display: inline-block;
  padding: 3px 10px;
  background: var(--soft);
  border-radius: 12px;
  font-size: 13px;
  color: var(--muted)
}

.user-info-section {
  border-top: 1px solid var(--line);
  padding-top: 16px
}

.user-info-section h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: var(--muted)
}

.user-info-bio {
  margin: 0;
  line-height: 1.6;
  color: var(--ink)
}

.user-info-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
}
.user-info-row:last-child { border-bottom: none; }
.user-info-row .label { color: var(--muted); margin-right: 8px; }

.user-info-empty,
.user-info-error {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 10px 0
}

.user-info-error {
  color: #c0392b
}

/* 点击头像/名字的交互效果 */
.user-info-trigger {
  cursor: pointer;
  transition: opacity .2s
}

.user-info-trigger:hover {
  opacity: .75
}

/* 在线用户浮窗 */
.online-widget {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  font-family: inherit
}

.online-panel {
  width: 220px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .12);
  overflow: hidden;
  animation: slideIn .25s ease
}

.online-widget.collapsed .online-panel {
  display: none
}

.online-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa
}

.online-title {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  display: flex;
  align-items: center;
  gap: 6px
}

.online-count {
  font-size: 12px;
  background: #e8f5e9;
  color: #2e7d32;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 500
}

.online-toggle-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: #999;
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1
}

.online-toggle-btn:hover {
  background: #f0f0f0;
  color: #666
}

.online-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px
}

.online-list:empty::after {
  content: '暂无在线用户';
  display: block;
  text-align: center;
  padding: 20px 0;
  font-size: 13px;
  color: #bbb
}

.online-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s
}

.online-item:hover {
  background: #f5f5f5
}

.online-item-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #f0f0f0;
  flex-shrink: 0
}

.online-item-info {
  flex: 1;
  min-width: 0
}

.online-item-name {
  font-size: 14px;
  color: #333;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.online-item-badge {
  font-size: 10px;
  padding: 1px 6px;
  background: #fef3c7;
  color: #92400e;
  border-radius: 8px;
  font-weight: 500;
  flex-shrink: 0
}

.online-expand-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #e8e8e8;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .1);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform .2s
}

.online-expand-btn:hover {
  transform: scale(1.08)
}

.online-widget.collapsed .online-expand-btn {
  display: flex
}

.online-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4caf50;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, .2);
  animation: pulse 2s infinite
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(76, 175, 80, .2)
  }

  50% {
    box-shadow: 0 0 0 6px rgba(76, 175, 80, .05)
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px)
  }

  to {
    opacity: 1;
    transform: translateX(0)
  }
}

/* 锚点跳转偏移，避免被顶部导航挡住 */
#articles {
  scroll-margin-top: 80px
}

/* 评论操作按钮对齐 */
.comment-actions {
  align-items: center
}

.comment-actions .text-button {
  line-height: 1;
  vertical-align: middle;
  display: inline-flex;
  align-items: center
}

/* 评论/留言操作按钮强制对齐 */
.comment-actions {
  display: flex !important;
  align-items: center !important;
  gap: 14px;
  margin-top: 6px
}

.comment-actions .text-button {
  display: inline-block !important;
  height: auto !important;
  line-height: normal !important;
  vertical-align: baseline !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 12px !important
}


/* 页面标题区域上下空隙调小，保持一致 */
.page-hero {
  padding: 40px 0 !important;
  margin-bottom: 0 !important
}
/* 游戏入口按钮 */
.game-entry-btn{position:fixed;right:24px;bottom:24px;width:56px;height:56px;border-radius:50%;background:#a67c52;color:#fff;font-size:24px;display:flex;align-items:center;justify-content:center;text-decoration:none;box-shadow:0 4px 16px rgba(166,124,82,0.4);z-index:15;transition:transform 0.2s,box-shadow 0.2s}
.game-entry-btn:hover{transform:scale(1.1);box-shadow:0 6px 20px rgba(166,124,82,0.5);background:#8b6942}
