:root {
  --bg-deep: #050a17;
  --bg-mid: #0a1329;
  --bg-top: #162447;
  --text: #ece5d8;
  --text-dim: #9ba6bd;
  --gold: #cbb28a;
  --bubble: rgba(27, 43, 74, 0.72);
  --line: rgba(203, 178, 138, 0.22);
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: radial-gradient(ellipse at 50% 12%, var(--bg-top) 0%, var(--bg-mid) 48%, var(--bg-deep) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Songti SC", "STSong", "SimSun", "Kaiti SC", "KaiTi", serif;
  overflow: hidden;
  letter-spacing: 0.06em;
}

/* 星空 */
#sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; }

.star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  animation: twinkle var(--dur, 4s) ease-in-out infinite alternate;
}

@keyframes twinkle {
  from { opacity: 0.12; transform: scale(0.7); }
  to   { opacity: var(--op, 0.8); transform: scale(1); }
}

.wrap {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 20px 14px;
  display: flex;
  flex-direction: column;
}

/* 头像与标题 */
.hero { text-align: center; flex: 0 0 auto; }

.avatar {
  display: block;
  width: 92px;
  height: 92px;
  margin: 2px auto 14px;
  padding: 0;
  border: none;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 0 0 6px rgba(203, 178, 138, 0.08), 0 0 40px rgba(146, 171, 226, 0.30);
  animation: breathe 6s ease-in-out infinite;
  transition: filter 0.2s;
}

.avatar:hover { filter: brightness(1.08); }

.avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 58% 22%;
}

@keyframes breathe {
  0%, 100% { transform: scale(1);    box-shadow: 0 0 0 6px rgba(203,178,138,.06), 0 0 34px rgba(146,171,226,.24); }
  50%      { transform: scale(1.035); box-shadow: 0 0 0 9px rgba(203,178,138,.11), 0 0 52px rgba(146,171,226,.40); }
}

h1 {
  margin: 0;
  font-size: 29px;
  font-weight: 500;
  letter-spacing: 0.38em;
  text-indent: 0.38em;
}

.subtitle {
  margin: 7px 0 0;
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 0.22em;
  text-indent: 0.22em;
}

.presence {
  margin: 10px 0 0;
  font-size: 11px;
  color: rgba(155, 166, 189, 0.75);
  letter-spacing: 0.14em;
}

.online-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 7px;
  vertical-align: 2px;
  border-radius: 50%;
  background: #9fd4b0;
  box-shadow: 0 0 8px rgba(159, 212, 176, 0.7);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse { 50% { opacity: 0.35; } }

/* 清空聊天记录：可辨识的描边小按钮，不抢主视觉但一眼能找到 */
.clear-history-btn {
  margin-top: 14px;
  padding: 5px 12px;
  border: 1px solid rgba(203, 178, 138, 0.30);
  border-radius: 999px;
  background: rgba(203, 178, 138, 0.06);
  color: rgba(203, 178, 138, 0.72);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.clear-history-btn span { font-size: 13px; margin-right: 3px; }
.clear-history-btn:hover {
  color: rgba(230, 156, 156, 0.95);
  border-color: rgba(230, 156, 156, 0.55);
  background: rgba(230, 156, 156, 0.10);
}

/* 清空确认弹层 */
.confirm-overlay { z-index: 25; }
.confirm-card {
  width: min(86vw, 320px);
  padding: 26px 24px 22px;
  text-align: center;
  border: 1px solid rgba(203, 178, 138, 0.2);
  border-radius: 20px;
  background: radial-gradient(circle at 50% 18%, rgba(30, 47, 82, 0.95), rgba(8, 15, 32, 0.98));
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.55);
}
.confirm-title {
  margin: 0 0 12px;
  font-size: 17px;
  letter-spacing: 0.12em;
  text-indent: 0.12em;
}
.confirm-desc {
  margin: 0 0 22px;
  font-size: 13px;
  line-height: 1.9;
  color: var(--text-dim);
}
.confirm-actions { display: flex; gap: 12px; justify-content: center; }
.confirm-actions button {
  flex: 1;
  max-width: 120px;
  padding: 9px 0;
  border-radius: 20px;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}
.confirm-cancel {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
}
.confirm-cancel:hover { background: rgba(203, 178, 138, 0.1); }
.confirm-ok {
  border: 1px solid rgba(217, 139, 139, 0.5);
  background: rgba(217, 139, 139, 0.18);
  color: #f0c9c9;
}
.confirm-ok:hover { background: rgba(217, 139, 139, 0.3); }

/* 对话区 */
.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 4px 10px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(203,178,138,.25) transparent;
}

.messages::-webkit-scrollbar { width: 5px; }
.messages::-webkit-scrollbar-thumb { background: rgba(203,178,138,.25); border-radius: 3px; }

.row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  animation: rise 0.35s ease-out;
}

.row.user { justify-content: flex-end; }
.row-body { max-width: 78%; }

.tiny-avatar {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 58% 22%;
  border: 1px solid rgba(203, 178, 138, 0.35);
  box-shadow: 0 0 14px rgba(146, 171, 226, 0.18);
  margin-bottom: 2px;
  cursor: pointer;
  transition: filter 0.2s, transform 0.2s;
}

.tiny-avatar:hover { filter: brightness(1.12); transform: scale(1.06); }

.speaker {
  margin: 0 0 4px 4px;
  font-size: 11px;
  color: rgba(203, 178, 138, 0.72);
  letter-spacing: 0.16em;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bubble {
  max-width: 100%;
  padding: 11px 16px;
  border-radius: 17px;
  font-size: 15px;
  line-height: 1.85;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble.assistant {
  background: var(--bubble);
  border: 1px solid rgba(203, 178, 138, 0.12);
  border-bottom-left-radius: 5px;
}

.bubble.user {
  max-width: 78%;
  background: rgba(203, 178, 138, 0.14);
  border: 1px solid var(--line);
  border-bottom-right-radius: 5px;
}

/* 输入中：三个呼吸的小点 */
.typing { display: inline-flex; gap: 5px; padding: 3px 0; }

.typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  animation: bounce 1.2s ease-in-out infinite;
}

.typing i:nth-child(2) { animation-delay: 0.16s; }
.typing i:nth-child(3) { animation-delay: 0.32s; }

@keyframes bounce {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-4px); }
}

.caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -0.14em;
  background: var(--gold);
  animation: blink 1s step-end infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* 输入区：微信式——圆角输入栏，文字可换行长高，发送按钮有内容才亮 */
.composer {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 6px;
  padding: 6px 6px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(8, 16, 35, 0.82);
  backdrop-filter: blur(8px);
}

.composer textarea {
  flex: 1;
  min-width: 0;
  min-height: 30px;
  max-height: 132px;
  padding: 6px 4px;
  border: none;
  outline: none;
  resize: none;
  overflow-y: auto;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0.06em;
  scrollbar-width: thin;
}

.composer textarea::placeholder { color: rgba(155, 166, 189, 0.55); }

/* 微信里发送键默认弱化，输入内容后才亮起 */
.send-btn {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 15px;
  border: none;
  border-radius: 17px;
  background: rgba(203, 178, 138, 0.16);
  color: rgba(155, 166, 189, 0.7);
  font: inherit;
  font-size: 14px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.18s;
}

.send-btn.ready {
  background: var(--gold);
  color: #0a1329;
}

.send-btn:active { transform: scale(0.96); }
.send-btn:disabled { opacity: 0.45; cursor: default; transform: none; }

.listen-btn { align-self: flex-end; margin-bottom: 2px; }

/* 聊天 / 动态 切换 */
.tabs {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 14px 0 2px;
}

.tab {
  position: relative;
  padding: 6px 22px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.16em;
  cursor: pointer;
  transition: all 0.2s;
}

.tab:hover { color: var(--text); }
.tab.active {
  color: var(--text);
  border-color: var(--line);
  background: rgba(203, 178, 138, 0.08);
}

.tab-dot {
  position: absolute;
  top: 4px;
  right: 9px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #d98b8b;
  box-shadow: 0 0 7px rgba(217, 139, 139, 0.7);
}

.view { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.view[hidden] { display: none; }

/* 动态（朋友圈） */
.moments-feed {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 2px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(203,178,138,.25) transparent;
}

.moments-feed::-webkit-scrollbar { width: 5px; }
.moments-feed::-webkit-scrollbar-thumb { background: rgba(203,178,138,.25); border-radius: 3px; }

.wrap.moments-mode .hero { display: none; }
.wrap.moments-mode .tabs { margin: 2px 0 8px; }

/* 手机键盘弹起：像微信那样只留一条标题栏，收起大头像和切页 tab，把空间留给消息 */
.wrap.focus-mode { padding-top: 6px; }
.wrap.focus-mode .hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 2px 0 6px;
  border-bottom: 1px solid rgba(203, 178, 138, 0.1);
}
.wrap.focus-mode .avatar {
  width: 26px;
  height: 26px;
  margin: 0;
  animation: none;
  box-shadow: 0 0 0 1px rgba(203, 178, 138, 0.25);
}
.wrap.focus-mode h1 {
  font-size: 16px;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
}
.wrap.focus-mode .subtitle,
.wrap.focus-mode .presence,
.wrap.focus-mode .clear-history-btn,
.wrap.focus-mode .tabs { display: none; }
.wrap.focus-mode .messages { padding-top: 8px; min-height: 90px; }
.wrap.focus-mode .composer { flex: 0 0 auto; }

.moment-cover {
  position: relative;
  height: 190px;
  border-radius: 16px;
  overflow: visible;
}

.moment-cover > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 38%;
  border-radius: 16px;
  filter: brightness(0.52) saturate(0.85);
}

.cover-text {
  position: absolute;
  right: 18px;
  bottom: 16px;
  text-align: right;
}

.cover-name { font-size: 18px; letter-spacing: 0.2em; }
.cover-sign { margin-top: 4px; font-size: 11px; color: rgba(236, 229, 216, 0.75); letter-spacing: 0.12em; }

.cover-avatar {
  position: absolute;
  right: 18px;
  bottom: -22px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #0a1329;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

.post {
  padding: 28px 0 18px;
  border-bottom: 1px solid rgba(203, 178, 138, 0.1);
  animation: rise 0.35s ease-out;
}

.post-head { display: flex; align-items: center; gap: 10px; }

.post-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(203, 178, 138, 0.3);
}

.post-name { font-size: 14px; letter-spacing: 0.1em; }
.post-time { margin-left: auto; font-size: 11px; color: var(--text-dim); }

.post-text {
  margin: 11px 0 12px;
  font-size: 14px;
  line-height: 1.9;
  white-space: pre-line;
}

.post-photo {
  display: block;
  width: 100%;
  max-width: 430px;
  height: auto;
  border-radius: 10px;
  cursor: zoom-in;
  border: 1px solid rgba(203, 178, 138, 0.12);
}

.post-actions { display: flex; gap: 20px; margin-top: 12px; }

.act {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 0;
}

.act:hover { color: var(--text); }
.act.liked { color: #d98b8b; }

.comment-box { display: none; margin-top: 10px; gap: 8px; }
.comment-box.open { display: flex; }

.comment-box input {
  flex: 1;
  min-width: 0;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 16, 35, 0.7);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  outline: none;
}

/* 发言人名字：窄一些，和评论框并排 */
.comment-box input.comment-name {
  flex: 0 0 88px;
  width: 88px;
}

/* 评论者自己的名字用暖金色，和密多女的回复区分开 */
.comment-line.mine-user .c-name { color: var(--gold, #cbb28a); }

/* 朋友圈式评论列表：默认可见，营造热闹感 */
.comment-list {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(203, 178, 138, 0.05);
  border: 1px solid rgba(203, 178, 138, 0.08);
}

.comment-line {
  font-size: 12px;
  line-height: 1.75;
  color: rgba(200, 208, 226, 0.9);
  white-space: pre-wrap;
}
.comment-line + .comment-line { margin-top: 4px; }
.comment-line .c-name { color: #9fb4e6; }
/* 密多女本人的回复 */
.comment-line.mine .c-name { color: var(--gold, #cbb28a); }
.comment-line.mine .c-text { color: rgba(203, 178, 138, 0.92); }

/* 用户新评论：强调一下 */
.comment-line.just-added { animation: comment-in 0.4s ease-out; }
@keyframes comment-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 看大图 */
.photo-overlay { z-index: 30; background: rgba(3, 7, 16, 0.94); }
.photo-overlay img {
  max-width: 92vw;
  max-height: 86vh;
  border-radius: 8px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.6);
}

.photo-close {
  position: absolute;
  top: 18px;
  right: 24px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

/* 一起听 5 分钟 */
.listen-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid rgba(203, 178, 138, 0.28);
  border-radius: 16px;
  background: rgba(203, 178, 138, 0.08);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.listen-moon { font-size: 14px; }
.listen-label { letter-spacing: 0.04em; }

/* 她说「闭眼听 / 一起听」时，那句话本身可点 */
.bubble.invite-bubble {
  cursor: pointer;
  border-bottom: 1px dashed rgba(203, 178, 138, 0.6);
  transition: background 0.2s;
}
.bubble.invite-bubble:hover { background: rgba(203, 178, 138, 0.16); }
.bubble.invite-bubble::after {
  content: ' 🌙';
  opacity: 0.75;
  font-size: 11px;
}

.listen-btn:hover { background: rgba(203, 178, 138, 0.2); transform: scale(1.08); }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 9, 20, 0.88);
  backdrop-filter: blur(10px);
}

.overlay[hidden] { display: none; }

.listen-card {
  width: min(86vw, 340px);
  padding: 44px 24px 30px;
  text-align: center;
  border: 1px solid rgba(203, 178, 138, 0.2);
  border-radius: 24px;
  background: radial-gradient(circle at 50% 20%, rgba(30, 47, 82, 0.9), rgba(8, 15, 32, 0.96));
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.5);
}

.breathe-circle {
  width: 132px;
  height: 132px;
  margin: 0 auto 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 36%, rgba(244, 231, 211, 0.55), rgba(146, 171, 226, 0.24) 65%, transparent 72%);
  box-shadow: 0 0 50px rgba(146, 171, 226, 0.28);
  animation: breatheCycle 8s ease-in-out infinite;
}

@keyframes breatheCycle {
  0%, 100% { transform: scale(0.72); opacity: 0.55; }
  50%      { transform: scale(1.12); opacity: 1; }
}

#listen-hint {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
}

.listen-time {
  margin: 12px 0 20px;
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 0.18em;
}

.sound-picker {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 0 22px;
}

.sound-opt {
  padding: 6px 12px;
  border: 1px solid rgba(203, 178, 138, 0.25);
  border-radius: 16px;
  background: rgba(203, 178, 138, 0.05);
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.sound-opt:hover { background: rgba(203, 178, 138, 0.15); }

.sound-opt.active {
  border-color: rgba(203, 178, 138, 0.7);
  background: rgba(203, 178, 138, 0.22);
  color: var(--text-bright, #f2ead8);
}

.listen-close {
  padding: 8px 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.listen-close:hover { background: rgba(203, 178, 138, 0.12); }

@media (max-width: 520px) {
  .wrap { padding: 16px 14px 10px; }
  .avatar { width: 76px; height: 76px; margin-bottom: 12px; }
  h1 { font-size: 25px; }
  .row-body { max-width: 82%; }
  .bubble.user { max-width: 86%; }
  .bubble { font-size: 14px; }
}
