:root {
  --bg: #1b2333;
  --panel: #232d45;
  --panel-2: #2a3654;
  --line: #3b4869;
  --text: #eef1f8;
  --muted: #a8b4ca;
  --accent: #b4aef2;
  --accent-deep: #7f77dd;
  --teal: #6fd8b2;
  --danger: #e24b4a;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  height: 100vh; display: flex; flex-direction: column;
  font-size: 15px;
}

/* 顶栏 */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-dot {
  width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--accent) 0%, var(--accent-deep) 70%);
  flex: none;
}
.brand-name { font-weight: 500; font-size: 16px; }
.brand-sub { font-size: 12px; color: var(--muted); }
@media (max-width: 600px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .brand { min-width: 160px; }
  .top-right { width: 100%; justify-content: space-between; gap: 6px !important; }
  .top-right>* { flex-shrink: 0; }
}
.top-right { display: flex; align-items: center; gap: 10px; }
.mode-tag {
  font-size: 12px; color: var(--accent); border: 1px solid var(--accent-deep);
  padding: 3px 10px; border-radius: 999px;
}
.mode-tag.morning { color: var(--teal); border-color: var(--teal); }
.icon-btn {
  background: none; border: 1px solid var(--line); color: var(--text);
  width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: 15px;
}
.icon-btn:hover { border-color: var(--accent); }

/* 消息区 */
.chat { flex: 1; overflow-y: auto; padding: 18px 16px 10px; display: flex; flex-direction: column; gap: 12px; }
/* 右边给 AI 形象留一条「站位」，消息不再钻到人物身后（窄屏就不留了，宁可让一点） */
@media (min-width: 860px) { .chat { padding-right: 226px; } }
/* 宽屏再让出天气卡的位置：卡宽 226 + 右边距 10 + 缓冲，避免卡片压住消息 */
@media (min-width: 1000px) { .chat { padding-right: 248px; } }
/* 手机端形象尺寸/位置见下方「探边」区块（此处若早于 .mascot 主规则写会被覆盖，故统一放在后面） */
.msg { max-width: 78%; padding: 10px 14px; border-radius: var(--radius); line-height: 1.65; white-space: pre-wrap; }
.msg.bot { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.user { align-self: flex-end; background: #2c2a4d; border: 1px solid #4a4580; border-bottom-right-radius: 4px; }
.msg.system { align-self: center; background: none; color: var(--muted); font-size: 12px; padding: 2px; }
.msg .small { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* 卡片 */
.card {
  align-self: flex-start; max-width: 86%;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.card h4 { font-size: 14px; font-weight: 500; margin-bottom: 10px; color: var(--text); }
.card .hint { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chip {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  padding: 7px 14px; border-radius: 999px; cursor: pointer; font-size: 13px;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.primary { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }
.chip.ghost { background: none; }
input[type="range"] { width: 100%; accent-color: var(--accent-deep); }
.slider-val { text-align: center; font-size: 22px; color: var(--accent); margin: 4px 0 8px; }
.card input[type="text"], .card input[type="time"] {
  width: 100%; background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 9px 12px; font-size: 14px; margin-bottom: 4px;
}
.card textarea[aria-label="写下梦境片段"] {
  width: 100%; min-height: 88px; resize: vertical; background: var(--bg); border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 10px 12px; font: inherit; line-height: 1.6;
}
.card textarea[aria-label="写下梦境片段"]:focus { outline: none; border-color: var(--accent); }
.dream-feelings { margin: 10px 0; }
.dream-mic-row { margin: 8px 0 2px; }
.dream-memory-row { align-items: flex-start; }
.dream-memory-text { min-width: 0; flex: 1; line-height: 1.5; overflow-wrap: anywhere; }
.card input:focus { outline: none; border-color: var(--accent); }

/* 仪式计时 */
.ritual-step-title { font-size: 15px; color: var(--text); margin: 6px 0 4px; }
.ritual-step-text { font-size: 13px; color: var(--muted); line-height: 1.7; }
.ritual-cue { font-size: 12.5px; color: var(--muted); line-height: 1.7; margin: 2px 0 6px; font-style: normal; opacity: 0.9; }
.ritual-timer {
  font-size: 42px; text-align: center; color: var(--teal);
  margin: 12px 0; font-variant-numeric: tabular-nums; letter-spacing: 2px;
}
.ritual-progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-bottom: 6px; }
.ritual-progress i { display: block; height: 100%; background: var(--teal); width: 0%; transition: width 1s linear; }

/* 趋势图 */
.trend-wrap { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.trend-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }

/* 输入区 */
.inputbar { border-top: 1px solid var(--line); background: var(--panel); padding: 10px 16px 8px; }
.quick-replies { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; min-height: 0; }
.input-row { display: flex; gap: 8px; }
#freeText {
  flex: 1; background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 14px; font-size: 14px;
}
#freeText:focus { outline: none; border-color: var(--accent); }
.send-btn {
  background: var(--accent-deep); color: #fff; border: none; border-radius: 10px;
  padding: 0 20px; cursor: pointer; font-size: 14px;
}
.footer-note { text-align: center; font-size: 11px; color: var(--muted); margin-top: 6px; }

/* 设置面板 */
.settings {
  position: fixed; inset: 0; background: rgba(5, 8, 15, 0.7);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.settings.hidden { display: none; }
.settings-card {
  width: min(440px, 92vw); background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 20px;
}
.settings-card h3 { font-size: 15px; font-weight: 500; margin-bottom: 14px; }
.switch-row { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 14px; font-size: 13px; }
.switch-row small { color: var(--muted); line-height: 1.6; display: block; margin-top: 3px; }
.switch-row input { width: 40px; height: 22px; accent-color: var(--accent-deep); margin-top: 3px; }
.settings-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ghost-btn, .danger-btn {
  padding: 8px 14px; border-radius: 10px; cursor: pointer; font-size: 13px;
  background: none; border: 1px solid var(--line); color: var(--text);
}
.danger-btn { border-color: var(--danger); color: var(--danger); }
.ghost-btn:hover { border-color: var(--accent); }
.settings-note { font-size: 11px; color: var(--muted); line-height: 1.7; margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.local-mode-note { margin: 14px 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(244, 246, 250, .94); color: #33405c; line-height: 1.7; }
.local-mode-note b { color: #1b2333; }  /* 浅底必须配深字，否则隐私说明看不清（2026-10-30 修） */
.plan-card, .memory-card { max-width: 620px; }
.plan-line { margin: 8px 0; line-height: 1.6; }
.memory-row { display: flex; align-items: center; gap: 7px; margin: 8px 0; }
.memory-row input { min-width: 0; flex: 1; }
.plan-title { margin-top: 14px; font-weight: 650; }

/* 转介卡 */
.card.referral { border-color: var(--danger); }
.card.referral h4 { color: var(--danger); }

/* 转场动画 */
.fade-in { animation: fadein 0.35s ease both; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) { .fade-in { animation: none; } }

/* ============================================================
 * 氛围层：星空 · 随阶段流动的背景光 · 会变表情的 Pond
 * ============================================================ */
.sky, .glow { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.topbar, .chat, .inputbar, .settings { position: relative; z-index: 1; }

/* 星空：夜晚阶段可见 */
.sky {
  opacity: 0; transition: opacity 2.5s ease;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #cfd6ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 28% 8%, #aab3e8 50%, transparent 51%),
    radial-gradient(1px 1px at 45% 22%, #dfe4ff 50%, transparent 51%),
    radial-gradient(2px 2px at 63% 12%, #b9c1f5 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 26%, #cfd6ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 88% 15%, #aab3e8 50%, transparent 51%),
    radial-gradient(1px 1px at 8% 42%, #dfe4ff 50%, transparent 51%),
    radial-gradient(1px 1px at 92% 44%, #b9c1f5 50%, transparent 51%);
  animation: twinkle 7s ease-in-out infinite alternate;
}
body[data-stage="NIGHT_S2_RUN"] .sky,
body[data-stage="NIGHT_S3"] .sky,
body[data-stage="NIGHT_DONE"] .sky { opacity: 1; }
@keyframes twinkle { from { opacity: .45; } to { opacity: 1; } }

/* 三层柔光，按阶段淡入淡出（opacity 可平滑过渡） */
.glow { opacity: 0; transition: opacity 2.5s ease; }
.glow-night {
  background: radial-gradient(70% 45% at 50% -5%, rgba(93,110,220,.35) 0%, transparent 70%);
}
.glow-calm {
  background: radial-gradient(85% 55% at 50% 108%, rgba(93,202,165,.16) 0%, transparent 65%),
              radial-gradient(60% 40% at 50% -5%, rgba(127,119,221,.28) 0%, transparent 70%);
  animation: breathe 9s ease-in-out infinite;
}
.glow-dawn {
  background: radial-gradient(70% 45% at 50% -8%, rgba(255,196,128,.28) 0%, transparent 70%),
              radial-gradient(80% 50% at 50% 110%, rgba(93,202,165,.14) 0%, transparent 65%);
}
@keyframes breathe { 0%,100% { opacity: .55; transform: scale(1); } 50% { opacity: 1; transform: scale(1.06); } }

/* 阶段 → 背景色调与氛围层开关 */
body { transition: background-color 2.2s ease; }
body[data-stage="NIGHT_S1"] { background-color: #212940; }
body[data-stage="NIGHT_S1"] .glow-night { opacity: .8; }
body[data-stage="NIGHT_S2_PICK"] { background-color: #1d2436; }
body[data-stage="NIGHT_S2_PICK"] .glow-calm { opacity: .7; }
body[data-stage="NIGHT_S2_RUN"],
body[data-stage="NIGHT_S3"],
body[data-stage="NIGHT_DONE"] { background-color: #181e2e; }
body[data-stage="NIGHT_S2_RUN"] .glow-calm,
body[data-stage="NIGHT_S3"] .glow-calm { opacity: 1; }
body[data-stage="CRISIS"] { background-color: #191a26; }

/* 会变表情的 Pond：拟人少女立绘（2026-10-30 放大版）
   · 尺寸按「像一个人」来定：桌面 152×203（3:4 半身），窄屏 108×144
   · 待机一定要有动作：外层 .mascot 慢速上下浮 + 内层 img 轻微摇摆呼吸（两个不同周期，不机械）
   · 偶尔还会有一次「小动作」（歪头/伸懒腰/偷看），由 JS 加 .act-* 类触发
   · 呼吸节奏由 --breath 控制（仪式中放慢到 8s，和 4-7-8 呼吸同步）
   · 表情靠 data-expr 切换（idle/happy/sleepy/thinking），换图时做一次淡入淡出 */
.mascot {
  position: fixed; top: 58px; right: 4px; z-index: 3;
  width: 200px; height: 266px; cursor: pointer;
  display: flex; align-items: flex-end; justify-content: center;
  --m1: #b4aef2; --m2: #6b62c8; --breath: 5s;
  transition: filter .3s ease, width .3s ease, height .3s ease;
  animation: mascotFloat 7.2s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  touch-action: manipulation;
}
/* 聊天中/弹层打开时缩一点，把版面让出来 */
.mascot.compact { width: 138px; height: 184px; }
.mascot:hover { filter: brightness(1.08); }
.mascot.morning { --m1: #ffd596 !important; --m2: #d08a4a !important; }
.mascot-aura {
  position: absolute; left: 50%; top: 34%; width: 132%; height: 74%;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle, var(--m1) 0%, transparent 66%);
  opacity: .2; pointer-events: none;
  animation: auraBreath var(--breath) ease-in-out infinite;
}
.mascot-body {
  width: 100%; height: 100%; position: relative; z-index: 1;
  transform-origin: 50% 92%;
  animation: bodyBreath var(--breath) ease-in-out infinite;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,.35));
}
/* 头顶形态配饰（emoji 小徽章） */
.m-face {
  position: absolute; top: 2px; right: 0; z-index: 2;
  font-size: 15px; line-height: 1;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.45));
  transition: transform .3s ease;
}
/* ---- 表情切换 ---- */
.mascot .expr { display: none; }
.mascot[data-expr="idle"] .expr-idle { display: block; }
.mascot[data-expr="happy"] .expr-happy { display: block; }
.mascot[data-expr="sleepy"] .expr-sleepy { display: block; }
.mascot[data-expr="thinking"] .expr-thinking { display: block; }
.mascot .expr-happy, .mascot .expr-sleepy, .mascot .expr-thinking { transform-origin: 50% 50%; }
/* ---- 眨眼：JS 定期加 .blink ---- */
.m-eyes { transform-origin: 50% 52%; }
.m-eyes.blink { animation: blinkNow .16s ease; }
@keyframes blinkNow { 0%,100% { transform: scaleY(1); } 50% { transform: scaleY(.08); } }
/* ---- 点击弹跳 ---- */
.mascot.hop .mascot-body { animation: hopNow .45s cubic-bezier(.3,1.6,.5,1); }
@keyframes hopNow {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-7px) scale(1.06, .94); }
  70% { transform: translateY(0) scale(.96, 1.04); }
  100% { transform: translateY(0) scale(1); }
}
/* ---- 连击眩晕彩蛋 ---- */
.mascot.dizzy .mascot-body { animation: dizzyNow .9s ease-in-out; }
@keyframes dizzyNow {
  0% { transform: rotate(0deg); }
  20% { transform: rotate(-9deg); }
  40% { transform: rotate(9deg); }
  60% { transform: rotate(-7deg); }
  80% { transform: rotate(7deg); }
  100% { transform: rotate(0deg); }
}
/* ---- 说话气泡：挪到人物左手边，尖角朝她 ---- */
.mascot-bubble {
  position: fixed; top: 108px; right: 178px; z-index: 4;
  max-width: 236px; padding: 10px 14px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 14px; border-bottom-right-radius: 4px;
  font-size: 13.5px; line-height: 1.62; color: var(--text);
  box-shadow: 0 10px 26px rgba(0,0,0,.4);
  animation: bubbleIn .22s ease;
}
.mascot-bubble.hidden { display: none; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(-6px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes auraBreath { 0%,100% { opacity: .16; transform: translate(-50%,-50%) scale(.94); } 50% { opacity: .34; transform: translate(-50%,-50%) scale(1.08); } }
@keyframes bodyBreath { 0%,100% { transform: scale(1, 1); } 50% { transform: scale(1.035, 1.055); } }
/* ---- 待机动作：整幅上下浮 + 呼吸感（两个周期错开，不会显得机械） ---- */
@keyframes mascotFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
@keyframes mascotSway {
  0%, 100% { transform: rotate(-1.1deg) translateY(0) scale(1); }
  35% { transform: rotate(.4deg) translateY(-2px) scale(1.006); }
  70% { transform: rotate(1.2deg) translateY(1px) scale(1.004); }
}
/* ---- 偶发小动作（JS 加 .act-* 类，1~2 秒后移除） ---- */
@keyframes actTilt { 0%,100% { transform: rotate(0); } 30% { transform: rotate(-7deg) translateX(-2px); } 65% { transform: rotate(-4deg); } }
@keyframes actPeek { 0%,100% { transform: translateX(0) scale(1); } 40% { transform: translateX(-7px) scale(1.03); } }
@keyframes actStretch { 0%,100% { transform: scale(1,1); } 45% { transform: scale(.97,1.06) translateY(-4px); } }
@keyframes actNod { 0%,100% { transform: translateY(0); } 30% { transform: translateY(4px) scaleY(.985); } 60% { transform: translateY(1px); } }
.mascot.pulse .mascot-body { animation: mascotPulse 1.1s ease; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes mascotPulse { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .mascot, .mascot-body, .mascot-aura, .mascot-img { animation: none !important; }
}

/* ===== 手机端「探边」（2026-10-30 用户要求）=====
   手机屏幕窄，形象常驻会盖住聊天。所以：平时只露一条边（像她靠在屏幕边上），
   点一下整个人滑出来，8 秒没人理她自己缩回去；桌面端屏幕宽，保持常驻不参与。
   位移用 right 做过渡（transform 被 mascotFloat 动画占着，改它会被动画覆盖）
   露多少试过几版：46px 只剩一块白裙子认不出人，58px 刚好露出侧脸和肩线 */
@media (max-width: 859px) {
  .mascot {
    width: 176px; height: 234px; top: 54px;
    right: -118px;
    transition: right .52s cubic-bezier(.22,.9,.3,1), filter .3s ease, width .3s ease, height .3s ease;
  }
  .mascot.peek { right: 2px; }
  .mascot.compact { width: 128px; height: 170px; right: -84px; }
  .mascot.compact.peek { right: 2px; }
  /* 气泡跟着形象走：手机上一律贴右侧、留出左边可读宽度，别飘到屏幕外 */
  .mascot-bubble { top: 84px; right: 186px; max-width: 46vw; font-size: 13px; padding: 9px 12px; }
  /* 滑出来时会压住卡片文字，用一层柔光把她「托」起来，底下的字淡下去不打架 */
  .mascot::before {
    content: ""; position: absolute; inset: -14px -16px -10px -26px; z-index: 0;
    border-radius: 50%;
    background: radial-gradient(ellipse at 64% 56%, rgba(13,18,30,.62) 0%, rgba(13,18,30,.34) 46%, rgba(13,18,30,0) 72%);
    opacity: 0; pointer-events: none; transition: opacity .42s ease;
  }
  .mascot.peek::before { opacity: 1; }
  body[data-day] .mascot::before {
    background: radial-gradient(ellipse at 64% 56%, rgba(255,252,244,.86) 0%, rgba(255,252,244,.5) 46%, rgba(255,252,244,0) 72%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mascot, .glow-calm, .sky { animation: none; }
  body, .glow, .mascot { transition: none; }
}

/* 形态人格选单 */
.persona-block { margin-bottom: 14px; font-size: 13px; }
.persona-block b { font-weight: 500; }
.persona-block small { color: var(--muted); margin-left: 8px; }
.persona-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.persona-chip { font-size: 12px; padding: 6px 11px; }

/* 语音合成中：🔊 按钮脉冲提示（文字先到、语音在路上的可视化） */
.icon-btn.voice-loading { animation: voiceLoading 1s ease-in-out infinite; opacity: .75; }
@keyframes voiceLoading { 0%,100% { transform: scale(1); } 50% { transform: scale(1.25); } }

/* ============================================================
 * 声画联动：生成式声景 → 全屏氛围层（听什么，画面就是什么）
 * data-sound 由 AudioEngine 写入 body；关闭后 2s 淡出
 * ============================================================ */
.soundfx {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: 0; transition: opacity 2.2s ease;
}
body[data-sound] .soundfx { opacity: 1; }

/* 🌧️ 落雨：青蓝夜 + 缓缓下移的雨丝 */
body[data-sound="rain"] .soundfx {
  background:
    repeating-linear-gradient(102deg, transparent 0 14px, rgba(148,178,235,.045) 14px 15px, transparent 15px 34px),
    radial-gradient(80% 55% at 50% -8%, rgba(96,132,196,.22) 0%, transparent 68%),
    radial-gradient(90% 60% at 50% 110%, rgba(64,96,160,.16) 0%, transparent 65%);
  animation: rainfall 1.9s linear infinite;
}
@keyframes rainfall { from { background-position: 0 0, 0 0, 0 0; } to { background-position: -34px 74px, 0 0, 0 0; } }

/* 🔥 篝火：暖琥珀 + 火星般的快速闪烁 */
body[data-sound="fire"] .soundfx {
  background:
    radial-gradient(75% 50% at 50% 112%, rgba(255,158,66,.26) 0%, transparent 66%),
    radial-gradient(55% 35% at 42% 96%, rgba(255,208,128,.14) 0%, transparent 70%);
  animation: fireflicker 2.1s ease-in-out infinite;
}
@keyframes fireflicker {
  0%,100% { opacity: .95; }
  18% { opacity: .78; }
  37% { opacity: 1; }
  55% { opacity: .84; }
  76% { opacity: 1; }
}

/* 🌊 溪流：水绿 + 缓慢横漂 */
body[data-sound="stream"] .soundfx {
  background:
    radial-gradient(70% 45% at 20% 108%, rgba(94,204,180,.18) 0%, transparent 64%),
    radial-gradient(70% 45% at 82% 104%, rgba(88,168,200,.15) 0%, transparent 64%),
    radial-gradient(60% 38% at 50% -6%, rgba(104,150,214,.16) 0%, transparent 70%);
  animation: streamdrift 13s ease-in-out infinite alternate;
}
@keyframes streamdrift { from { transform: translateX(-1.6%); } to { transform: translateX(1.6%); } }

/* 🍃 晚风：薄荷灰绿 + 极慢摇曳 */
body[data-sound="wind"] .soundfx {
  background:
    radial-gradient(85% 55% at 50% 110%, rgba(148,208,178,.15) 0%, transparent 66%),
    radial-gradient(70% 45% at 50% -8%, rgba(168,196,178,.13) 0%, transparent 70%);
  animation: windsway 11s ease-in-out infinite alternate;
  transform-origin: 50% 100%;
}
@keyframes windsway { from { transform: rotate(-1.1deg) scale(1.01); } to { transform: rotate(1.1deg) scale(1.01); } }

@media (prefers-reduced-motion: reduce) {
  .soundfx { animation: none; }
}

/* ============================================================
 * 声画联动加强版：整体背景色偏移 + 高浓度氛围层（v2，覆盖上方初版）
 * ============================================================ */
body[data-sound="rain"]  { background-color: #1b2536 !important; }
body[data-sound="fire"]  { background-color: #2b1d10 !important; }
body[data-sound="stream"]{ background-color: #172825 !important; }
body[data-sound="wind"]  { background-color: #1b2621 !important; }

body[data-sound="rain"] .soundfx {
  background:
    repeating-linear-gradient(102deg, transparent 0 13px, rgba(158,190,245,.10) 13px 15px, transparent 15px 33px),
    radial-gradient(85% 60% at 50% -10%, rgba(110,150,220,.34) 0%, transparent 70%),
    radial-gradient(95% 65% at 50% 112%, rgba(70,105,175,.30) 0%, transparent 66%);
  animation: rainfall 1.6s linear infinite;
}
body[data-sound="fire"] .soundfx {
  background:
    radial-gradient(85% 58% at 50% 114%, rgba(255,150,54,.44) 0%, transparent 68%),
    radial-gradient(60% 40% at 40% 100%, rgba(255,204,120,.26) 0%, transparent 72%),
    radial-gradient(70% 45% at 50% -10%, rgba(200,110,40,.14) 0%, transparent 70%);
  animation: fireflicker 2.1s ease-in-out infinite;
}
body[data-sound="stream"] .soundfx {
  background:
    radial-gradient(75% 50% at 18% 110%, rgba(96,220,190,.26) 0%, transparent 64%),
    radial-gradient(75% 50% at 84% 106%, rgba(90,175,215,.22) 0%, transparent 64%),
    radial-gradient(65% 42% at 50% -8%, rgba(110,160,225,.24) 0%, transparent 70%);
  animation: streamdrift 11s ease-in-out infinite alternate;
}
body[data-sound="wind"] .soundfx {
  background:
    radial-gradient(90% 60% at 50% 112%, rgba(150,215,180,.24) 0%, transparent 68%),
    radial-gradient(75% 48% at 50% -10%, rgba(175,205,185,.20) 0%, transparent 70%);
  animation: windsway 10s ease-in-out infinite alternate;
}

/* 篝火模式下吉祥物也染上暖光 */
body[data-sound="fire"] .mascot { box-shadow: 0 0 26px rgba(255,160,70,.5), inset 0 0 10px rgba(255,200,120,.3); }
body[data-sound="rain"] .mascot { box-shadow: 0 0 22px rgba(120,160,230,.42); }
body[data-sound="stream"] .mascot { box-shadow: 0 0 22px rgba(100,210,185,.4); }
body[data-sound="wind"] .mascot { box-shadow: 0 0 22px rgba(150,210,175,.38); }

/* ============================================================
 * 场景实体粒子层（v3）：由 AudioEngine.sceneFX 注入，与声音同开关
 * ============================================================ */
.soundfx i { position: absolute; display: block; pointer-events: none; }

/* 火舌：暖色泪滴形 + 模糊 + 跳动 */
.fx-flame {
  bottom: -14px;
  background: linear-gradient(to top, rgba(255,116,18,.9), rgba(255,196,58,.6) 52%, rgba(255,240,180,.18) 80%, transparent);
  border-radius: 50% 50% 42% 42% / 64% 64% 30% 30%;
  filter: blur(6px);
  transform-origin: 50% 100%;
  mix-blend-mode: screen;
  animation: flameLeap ease-in-out infinite alternate;
}
@keyframes flameLeap {
  0%   { transform: scaleY(.9)  skewX(-4deg) scaleX(1);    opacity: .72; }
  30%  { transform: scaleY(1.14) skewX(5deg)  scaleX(.93); opacity: .96; }
  60%  { transform: scaleY(.97) skewX(-6deg) scaleX(1.06); opacity: .84; }
  100% { transform: scaleY(1.18) skewX(2deg)  scaleX(.95); opacity: 1; }
}

/* 火星：亮点升起、渐远渐灭 */
.fx-ember {
  bottom: 5%; width: 4px; height: 4px; border-radius: 50%;
  background: rgba(255,192,92,.95);
  box-shadow: 0 0 6px 2px rgba(255,150,50,.6);
  animation: emberRise linear infinite;
}
@keyframes emberRise {
  0%   { transform: translate(0, 0) scale(1);   opacity: 0; }
  12%  { opacity: .95; }
  100% { transform: translate(20px, -48vh) scale(.35); opacity: 0; }
}

/* 雨丝：细长水线坠落 */
.fx-drop {
  top: -26px; width: 1.6px;
  background: linear-gradient(to bottom, transparent, rgba(172,202,250,.8));
  animation: dropFall linear infinite;
}
@keyframes dropFall { to { transform: translateY(110vh); } }

/* 溪流：水波带横漂 + 水面亮片 */
.fx-wave {
  left: -10%; width: 120%; height: 15px;
  border-radius: 50%;
  background: radial-gradient(60% 100% at 50% 50%, rgba(140,232,206,.4), transparent 70%);
  filter: blur(4px);
  animation: waveFlow ease-in-out infinite alternate;
}
@keyframes waveFlow { from { transform: translateX(-4.5%); } to { transform: translateX(4.5%); } }
.fx-spark {
  width: 3px; height: 3px; border-radius: 50%;
  background: rgba(195,255,236,.85);
  box-shadow: 0 0 5px rgba(140,240,215,.65);
  animation: sparkDrift linear infinite;
}
@keyframes sparkDrift {
  from { transform: translateX(-4vw); opacity: 0; }
  25%  { opacity: .85; }
  to   { transform: translateX(104vw); opacity: 0; }
}

/* 晚风：翻滚飘过的叶子 */
.fx-leaf {
  left: -32px; width: 9px; height: 12px;
  background: rgba(172,222,182,.6);
  border-radius: 60% 40% 55% 45% / 55% 60% 40% 45%;
  animation: leafFly linear infinite;
}
@keyframes leafFly {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 0; }
  10%  { opacity: .85; }
  50%  { transform: translate(48vw, 6vh) rotate(420deg); }
  100% { transform: translate(103vw, -3vh) rotate(860deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .soundfx i { animation: none; opacity: .25; }
}

/* 新增场景氛围 + 粒子（雷雨闪电视觉 / 星光眨眼） */
body[data-sound="storm"]  { background-color: #181d2b !important; }
body[data-sound="ocean"]  { background-color: #142230 !important; }
body[data-sound="chime"]  { background-color: #1f2331 !important; }
body[data-sound="musicbox"] { background-color: #241f28 !important; }

body[data-sound="storm"] .soundfx {
  background:
    radial-gradient(85% 58% at 50% 112%, rgba(96,124,190,.30) 0%, transparent 68%),
    radial-gradient(80% 52% at 50% -10%, rgba(70,86,140,.26) 0%, transparent 70%);
}
body[data-sound="storm"] .soundfx::before { /* 闪电：随机感的频闪 */
  content: ""; position: absolute; inset: 0;
  background: rgba(214,226,255,.9);
  opacity: 0; animation: stormFlash 13s linear infinite;
}
@keyframes stormFlash { 0%,84%,100% { opacity: 0; } 86% { opacity: .8; } 89% { opacity: .1; } 92% { opacity: .55; } 95% { opacity: 0; } }

body[data-sound="ocean"] .soundfx {
  background:
    radial-gradient(90% 58% at 50% 114%, rgba(88,160,200,.26) 0%, transparent 68%),
    radial-gradient(75% 48% at 50% -10%, rgba(96,124,196,.18) 0%, transparent 70%);
}
body[data-sound="chime"] .soundfx,
body[data-sound="musicbox"] .soundfx {
  background:
    radial-gradient(80% 52% at 50% -10%, rgba(150,140,220,.20) 0%, transparent 70%),
    radial-gradient(85% 55% at 50% 112%, rgba(120,150,200,.14) 0%, transparent 66%);
}

/* 星光眨眼（风铃/八音盒） */
.fx-twinkle {
  width: 5px; height: 5px; border-radius: 50%;
  background: rgba(228,238,255,.95);
  box-shadow: 0 0 8px 2px rgba(190,215,255,.55);
  animation: twinkleDot ease-in-out infinite;
}
@keyframes twinkleDot { 0%,100% { transform: scale(.3); opacity: .12; } 50% { transform: scale(1); opacity: .95; } }

body[data-sound="storm"] .mascot { box-shadow: 0 0 24px rgba(130,160,230,.45); }
body[data-sound="ocean"] .mascot { box-shadow: 0 0 24px rgba(95,170,210,.42); }
body[data-sound="chime"] .mascot { box-shadow: 0 0 22px rgba(170,160,235,.4); }
body[data-sound="musicbox"] .mascot { box-shadow: 0 0 22px rgba(200,180,235,.4); }

/* ============================================================
 * 夜晚成长体系：连睡星图 / 主题之夜 / 徽章墙 / 梦境图鉴
 * ============================================================ */
.starmap { display: flex; gap: 10px; font-size: 22px; line-height: 1; margin: 6px 0 10px; }
.starmap .star { color: #3a4560; transition: color .8s ease, text-shadow .8s ease; }
.starmap .star.lit { color: #ffe9a8; text-shadow: 0 0 10px rgba(255,222,140,.8); }

.theme-banner {
  margin: 10px 0 14px; padding: 10px 14px; border-radius: 12px;
  background: linear-gradient(120deg, rgba(127,119,221,.16), rgba(93,202,165,.10));
  border: 1px solid rgba(160,160,240,.25);
}
.theme-banner b { display: block; font-weight: 600; margin-bottom: 3px; }
.theme-banner span { color: var(--muted); font-size: 13px; }

.badge-card { text-align: center; max-width: 320px; }
.badge-big { font-size: 44px; line-height: 1.2; animation: mascotPulse 1.1s ease; }

.badge-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.badge {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px; font-size: 12.5px;
  background: rgba(255,255,255,.04); border: 1px solid #2a3550;
  color: var(--muted); opacity: .55;
}
.badge.got { opacity: 1; color: var(--text); border-color: rgba(240,198,116,.5); background: rgba(240,198,116,.08); }
.badge .bicon { font-size: 16px; }

.dream-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 8px 0 4px; }
.dream-card {
  padding: 10px; border-radius: 12px; text-align: center;
  background: rgba(255,255,255,.04); border: 1px solid #2a3550;
}
.dream-emoji { font-size: 24px; }
.dream-date { font-size: 11px; color: var(--muted); margin: 4px 0 2px; }
.dream-text { font-size: 12px; line-height: 1.4; word-break: break-all; }

/* “对方正在输入…”指示器 */
.typing-dots { display: inline-flex; gap: 5px; align-items: center; padding: 4px 2px; }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); opacity: .5; animation: dotBounce 1.1s ease-in-out infinite; }
.typing-dots i:nth-child(2) { animation-delay: .18s; }
.typing-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes dotBounce { 0%,100% { transform: translateY(0); opacity: .4; } 50% { transform: translateY(-4px); opacity: .9; } }

/* ===== 2026-10-29 界面整体放大 + 倒计时提醒 ===== */
body { font-size: 16.5px; }
.msg { max-width: 88%; padding: 12px 16px; font-size: 16px; line-height: 1.7; }
.card { max-width: 94%; padding: 16px 18px; }
.card h4 { font-size: 16px; }
.card .hint { font-size: 13.5px; line-height: 1.65; }
.chip { font-size: 14.5px; padding: 9px 16px; }
.ritual-step-title { font-size: 17px; }
.ritual-cue { font-size: 14px; }
.ritual-timer { font-size: 48px; }
#freeText { font-size: 15.5px; }
.settings-card h3 { font-size: 16.5px; }
.ritual-countdown {
  color: var(--teal); font-weight: 600;
  animation: cdPulse 1s ease infinite;
}
@keyframes cdPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.09); opacity: 0.7; }
}

/* ===== 2026-10-30 逐字重播（暗号找回之前的对话原文） ===== */
.replay-divider {
  text-align: center; font-size: 12.5px; letter-spacing: 1px;
  color: var(--ink-soft, #8b93a7); margin: 14px auto 8px; width: 100%;
  opacity: 0.9;
}
.msg.replay { opacity: 0.72; font-size: 14px; padding: 9px 14px; line-height: 1.6; }
.msg.replay.bot { background: rgba(139, 147, 167, 0.10); }
.msg.replay.user { background: rgba(139, 147, 167, 0.18); }

/* ===== 2026-10-30 高级音乐卡（替换原生 audio 控件） ===== */
.music-card {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin: 6px 0 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  cursor: pointer;
  transition: background .25s ease, border-color .25s ease, transform .15s ease;
}
.music-card:hover { background: rgba(255, 255, 255, 0.10); border-color: rgba(255, 255, 255, 0.18); }
.music-card:active { transform: scale(0.985); }
a.music-card, a.music-card:visited { text-decoration: none; color: inherit; }
.music-cover {
  position: relative; width: 52px; height: 52px; border-radius: 10px;
  flex: none; display: flex; align-items: center; justify-content: center;
  overflow: hidden; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
.music-vinyl {
  position: absolute; inset: 0; opacity: 0;
  background: repeating-radial-gradient(circle at 50% 50%, rgba(255,255,255,.07) 0 1px, transparent 1px 3px);
  transition: opacity .4s ease;
}
.music-card.playing .music-vinyl { opacity: .85; animation: vinylSpin 5s linear infinite; }
@keyframes vinylSpin { to { transform: rotate(360deg); } }
.music-cover-note {
  position: relative; z-index: 2; font-size: 20px;
  color: rgba(255, 255, 255, 0.9); text-shadow: 0 1px 5px rgba(0, 0, 0, 0.45);
}
.music-card.playing .music-cover { box-shadow: 0 0 0 2px rgba(140, 200, 210, 0.45), 0 2px 14px rgba(0, 0, 0, 0.4); }
.music-info { flex: 1; min-width: 0; }
.music-title {
  font-weight: 600; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.music-artist { font-size: 12.5px; opacity: 0.65; margin-top: 2px; }
.music-note { font-size: 11.5px; opacity: 0.5; margin-top: 3px; line-height: 1.5; }
.music-progress {
  height: 3px; border-radius: 2px; margin-top: 8px;
  background: rgba(255, 255, 255, 0.14); overflow: hidden;
}
.music-progress i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, rgba(124, 198, 201, 0.95), rgba(157, 184, 255, 0.9));
  transition: width .3s linear;
}
.music-time {
  display: flex; justify-content: space-between;
  font-size: 10.5px; opacity: 0.55; margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.music-play {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.13); color: #fff;
  font-size: 15px; cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s ease, transform .12s ease;
}
.music-play:hover { background: rgba(255, 255, 255, 0.22); }
.music-play:active { transform: scale(0.92); }
.music-card.playing .music-play { background: rgba(124, 198, 201, 0.30); border-color: rgba(124, 198, 201, 0.55); }
.music-play-link { font-size: 16px; }
a.music-card .music-play { pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .music-card.playing .music-vinyl { animation: none; }
}

/* ============================================================
 * 昼夜双主题（2026-10-30）：白天亮色 · 夜间暗色
 * 白天阶段（MORNING_* / DAY_CHAT / NO_ENTRY）由 app.js 挂 data-day，
 * 夜间保持提亮后的暗色，形成肉眼可见的昼夜反差
 * ============================================================ */
body[data-day] {
  --bg: #f6f2e9;
  --panel: #ffffff;
  --panel-2: #fdfaf3;
  --line: #e3dccc;
  --text: #33302a;
  --muted: #80786a;
  --accent: #6f68c9;
  --accent-deep: #6f68c9;
  --teal: #2e9e7e;
  background-color: #f6f2e9;
}
body[data-day] .glow-dawn { opacity: .55; }

/* 日间：用户气泡换成浅紫，不沿用夜间深色 */
body[data-day] .msg.user { background: #e9e2f4; border-color: #cabfe6; }
body[data-day] .msg.replay.bot { background: rgba(128, 120, 106, 0.10); }
body[data-day] .msg.replay.user { background: rgba(128, 120, 106, 0.16); }

/* 日间：徽章墙 / 梦境图鉴 / 星图卡片适配亮底 */
body[data-day] .badge,
body[data-day] .dream-card { background: rgba(0, 0, 0, 0.035); border-color: #e3dccc; }
body[data-day] .starmap .star { color: #ddd5c3; }

/* 日间：音乐卡适配亮底（原为白色半透明叠层，亮底上不可见） */
body[data-day] .music-card { background: rgba(0, 0, 0, 0.035); border-color: rgba(0, 0, 0, 0.09); }
body[data-day] .music-card:hover { background: rgba(0, 0, 0, 0.06); border-color: rgba(0, 0, 0, 0.16); }
body[data-day] .music-cover { box-shadow: 0 2px 12px rgba(0, 0, 0, 0.16); }
body[data-day] .music-cover-note { color: #5a5348; text-shadow: none; }
body[data-day] .music-vinyl {
  background: repeating-radial-gradient(circle at 50% 50%, rgba(0,0,0,.10) 0 1px, transparent 1px 3px);
}
body[data-day] .music-card.playing .music-cover { box-shadow: 0 0 0 2px rgba(46, 158, 126, 0.45), 0 2px 14px rgba(0, 0, 0, 0.18); }
body[data-day] .music-progress { background: rgba(0, 0, 0, 0.12); }
body[data-day] .music-play {
  background: rgba(111, 104, 201, 0.14); border-color: rgba(111, 104, 201, 0.45); color: #4c4585;
}
body[data-day] .music-play:hover { background: rgba(111, 104, 201, 0.24); }
body[data-day] .music-card.playing .music-play {
  background: rgba(46, 158, 126, 0.20); border-color: rgba(46, 158, 126, 0.55); color: #1e6e57;
}

/* 日间：主题之夜横幅 / 设置弹层叠层微调 */
body[data-day] .theme-banner {
  background: linear-gradient(120deg, rgba(111, 104, 201, 0.12), rgba(46, 158, 126, 0.08));
  border-color: rgba(111, 104, 201, 0.28);
}
body[data-day] .settings { background: rgba(58, 52, 40, 0.42); }
body[data-day] .local-mode-note { background: #ffffff; }

/* ===== 2026-10-30 今日去处卡 v2（移动端优先：卡片实体化、封面更亮更大、按钮实心化） ===== */
.place-card {
  border-radius: 16px; overflow: hidden; margin: 4px 0 14px;
  background: var(--panel-2); border: 1px solid var(--line);
}
.place-cover {
  position: relative; height: 132px;
  background-size: cover; background-position: center;
  display: flex; align-items: flex-end; padding: 12px 14px;
  box-sizing: border-box;
}
.place-cover-img { filter: brightness(1.08) saturate(1.06); }
.place-cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(8, 12, 24, 0) 42%, rgba(8, 12, 24, 0.58) 100%);
}
.place-cat {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  font-size: 11px; letter-spacing: 1.5px; color: #fff;
  background: rgba(10, 14, 26, 0.45); border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px; padding: 3px 10px;
  backdrop-filter: blur(4px);
}
.place-title {
  position: relative; z-index: 2; color: #fff;
  font-weight: 600; font-size: 17.5px; letter-spacing: .5px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}
.place-body { padding: 12px 14px 14px; }
.place-why { font-size: 14px; line-height: 1.7; color: var(--text); opacity: .92; }
.place-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; gap: 8px;
}
.place-where { font-size: 12.5px; color: var(--muted); flex: 1; min-width: 0; }
.place-map {
  flex: none; font-size: 13px; font-weight: 500; text-decoration: none;
  color: var(--teal); border: 1px solid var(--teal); border-radius: 999px; padding: 6px 15px;
  transition: background .2s ease, transform .12s ease;
}
.place-map:hover { background: rgba(111, 216, 178, 0.18); }
.place-map:active { transform: scale(0.95); }
body[data-day] .place-map { color: #fff; background: #2e9e7e; border-color: #2e9e7e; }
body[data-day] .place-map:hover { background: #27906f; }

/* ===== 2026-10-30 正在播放浮条：声音开着时永远有一个显眼的关闭入口 ===== */
.sound-dock {
  position: fixed; right: 12px; bottom: 96px; z-index: 6;
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--teal);
  border-radius: 999px; padding: 5px 6px 5px 14px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.30);
  animation: fadein 0.35s ease both;
}
.sound-dock.hidden { display: none; }
.sound-dock-name {
  font-size: 13.5px; color: var(--teal); font-weight: 500;
  cursor: pointer; white-space: nowrap;
}
.sound-dock-close {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  border: none; cursor: pointer; font-size: 14px; line-height: 1;
  background: rgba(111, 216, 178, 0.18); color: var(--teal);
  display: flex; align-items: center; justify-content: center;
  transition: background .2s ease, transform .12s ease;
}
.sound-dock-close:hover { background: rgba(111, 216, 178, 0.32); }
.sound-dock-close:active { transform: scale(0.92); }
body[data-day] .sound-dock { box-shadow: 0 6px 22px rgba(60, 50, 30, 0.20); }
body[data-day] .sound-dock-close { background: rgba(46, 158, 126, 0.16); }
body[data-day] .sound-dock-close:hover { background: rgba(46, 158, 126, 0.30); }

/* ===== 2026-10-30 形态选择弹层（先选/试听/确认，替代点一下切一下） ===== */
.persona-sheet { width: min(460px, 94vw); display: flex; flex-direction: column; max-height: 86vh; }
.persona-sheet-sub { font-size: 12px; color: var(--muted); margin: -8px 0 10px; line-height: 1.6; }
.persona-scroll { overflow-y: auto; flex: 1; margin: 0 -4px; padding: 0 4px 2px; }
.persona-group-label { font-size: 11px; color: var(--muted); letter-spacing: .08em; margin: 12px 0 6px; }
.persona-group-label:first-child { margin-top: 0; }
.persona-list { display: flex; flex-direction: column; gap: 6px; }
.persona-item { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.persona-item.on { border-color: var(--accent); background: rgba(255,255,255,.05); }
.pi-emoji { font-size: 20px; width: 26px; text-align: center; flex: none; }
.pi-info { flex: 1; min-width: 0; }
.pi-name { font-size: 13.5px; }
.pi-desc { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.pi-play { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: none; color: var(--text); font-size: 11px; cursor: pointer; }
.pi-play.on { border-color: var(--accent); color: var(--accent); }
/* 声线统一时的静态小标（替换试听按钮，避免误导；不表示「不能换形态」） */
.pi-lock { flex: none; min-width: 30px; height: 20px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 10.5px; letter-spacing: .5px; opacity: .55; border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; }
.pi-check { flex: none; width: 16px; text-align: center; font-size: 13px; color: var(--accent); opacity: 0; }
.persona-item.on .pi-check { opacity: 1; }
.persona-sheet-actions { margin-top: 12px; }
.persona-confirm { padding: 10px 18px; border-radius: 10px; }
.persona-confirm:disabled { opacity: .45; cursor: default; }
/* 设置面板内的当前形态行 */
.persona-current { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; }
.pc-face { font-size: 20px; flex: none; }
.pc-meta { flex: 1; min-width: 0; }
.pc-meta b { font-weight: 500; font-size: 13.5px; }
.pc-meta small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.pc-change { flex: none; padding: 6px 12px; border-radius: 9px; border: 1px solid var(--line); background: none; color: var(--text); font-size: 12px; cursor: pointer; }
.pc-change:hover { border-color: var(--accent); }

/* ===== 2026-10-30 素材形象（图片模式）：加载成功才启用，失败自动回退 SVG ===== */
/* 待机动效三层叠加：外层 .mascot 上下浮(7.2s) + 这里左右轻摆(8.6s) + aura 呼吸(--breath)
   三个周期互质一点，看起来就不像同一个循环在打拍子 */
.mascot-img { display: none; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%;
  position: relative; z-index: 1;
  transform-origin: 50% 96%;
  animation: mascotSway 8.6s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.42));
  /* 立绘是半身裁切，下沿是一刀切——用遮罩淡出，看起来像从暗处浮出来，不是被截断 */
  -webkit-mask-image: linear-gradient(to bottom, #000 76%, rgba(0,0,0,0) 99%);
  mask-image: linear-gradient(to bottom, #000 76%, rgba(0,0,0,0) 99%);
  transition: opacity .16s ease, filter .45s ease; }
.mascot.use-img .mascot-img { display: block; }
.mascot.use-img .mascot-body { display: none; }
.mascot.use-img .m-face { display: none; }  /* 图片自带五官，不再叠形态 emoji */
.mascot-img.swapping { opacity: .15; }      /* 换表情时快速一闪，像眨了下眼 */
/* 偶发待机小动作：优先级高于 sway，动画结束自动回到 sway */
.mascot.act-tilt .mascot-img { animation: actTilt 1.5s ease-in-out; }
.mascot.act-peek .mascot-img { animation: actPeek 1.8s ease-in-out; }
.mascot.act-stretch .mascot-img { animation: actStretch 1.9s ease-in-out; }
.mascot.act-nod .mascot-img { animation: actNod 1.6s ease-in-out; }
.mascot.hop .mascot-img { animation: hopNow .45s cubic-bezier(.3,1.6,.5,1); }
.mascot.dizzy .mascot-img { animation: dizzyNow .9s ease-in-out; }
.mascot.pulse .mascot-img { animation: mascotPulse 1.1s ease; }
/* 困倦态：稍微压暗压软一点（换的是图，不做位移，避免和待机动效打架） */
.mascot[data-expr="sleepy"] .mascot-img { filter: brightness(.86) saturate(.86) drop-shadow(0 5px 12px rgba(0,0,0,.46)); }
.mascot[data-expr="happy"] .mascot-img { filter: brightness(1.05) saturate(1.06) drop-shadow(0 4px 12px rgba(0,0,0,.4)); }
@media (prefers-reduced-motion: reduce) { .mascot-img { animation: none; } }

/* ===== 明日天气小卡（2026-10-30） ===== */
.weather-pop {
  position: fixed; top: 296px; right: 10px; z-index: 5;
  width: 226px; padding: 13px 14px 12px;
  /* 用主题变量而不是写死深色：白天会自动变成奶白卡片 */
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: 15px;
  box-shadow: 0 14px 34px rgba(0,0,0,.28);
  animation: wpIn .3s cubic-bezier(.2,1,.4,1);
}
.weather-pop.hidden { display: none; }
@keyframes wpIn { from { opacity: 0; transform: translateY(-10px) scale(.96); } to { opacity: 1; transform: none; } }
.wp-close {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px;
  border: none; background: none; color: var(--muted); font-size: 17px; line-height: 1;
  border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.wp-close:hover { background: rgba(255,255,255,.1); color: var(--text); }
.wp-head { display: flex; align-items: center; gap: 9px; }
.wp-icon { font-size: 26px; line-height: 1; }
.wp-headtext { display: flex; flex-direction: column; }
.wp-headtext b { font-size: 13px; font-weight: 500; color: var(--muted); }
.wp-headtext span { font-size: 19px; color: var(--text); font-variant-numeric: tabular-nums; }
.wp-desc { font-size: 12.5px; color: var(--accent); margin-top: 6px; }
.wp-outfit { font-size: 13px; line-height: 1.62; color: var(--text); margin-top: 7px; }
.wp-outfit .wp-items { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.wp-outfit .wp-items i {
  font-style: normal; font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  background: rgba(127,119,221,.13); color: var(--accent); border: 1px solid rgba(127,119,221,.3);
}
.wp-tip { font-size: 11.5px; color: var(--muted); line-height: 1.55; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
@media (max-width: 700px) {
  .weather-pop { width: 200px; top: 232px; right: 6px; }
}

/* ===== 弹窗右上角关闭键（2026-10-30） ===== */
.settings-card { position: relative; }
.card-close {
  position: absolute; top: 10px; right: 10px;
  width: 30px; height: 30px; border-radius: 50%;
  border: none; background: none; color: var(--muted);
  font-size: 22px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.card-close:hover { background: rgba(255,255,255,.1); color: var(--text); }
.card-close:active { transform: scale(.92); }
/* 头部标题给关闭键让位 */
.settings-card h3 { padding-right: 34px; }
