/* ══════════════════════════════════════════════════════════════
   twi-effects.css — The Wandering Inn 沉浸式 UI 增强模块
   ══════════════════════════════════════════════════════════════ */

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   1. 消息类型差异化 — 叙事情景 (narr)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.msg.char .msg-b.narr {
  background: linear-gradient(135deg, rgba(212,165,116,0.05), rgba(212,165,116,0.01));
  border-left: 3px solid var(--amber);
  border-radius: 4px 14px 14px 4px;
  padding: 12px 18px;
  position: relative;
  box-shadow: inset 0 0 40px rgba(212,165,116,0.015);
  animation: narrFadeIn 0.5s ease-out;
}

@keyframes narrFadeIn {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* 羊皮纸纹理 overlay */
.msg.char .msg-b.narr::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(212,165,116,0.008) 2px,
    transparent 3px
  );
  pointer-events: none;
  border-radius: inherit;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   2. 消息类型差异化 — 角色对话 (dial)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.msg.char .msg-b.dial {
  position: relative;
  background: rgba(255,221,153,0.03);
  border: 1px solid rgba(212,165,116,0.1);
  border-radius: 14px 14px 14px 4px;
  padding: 12px 18px 12px 28px;
  animation: dialFadeIn 0.4s ease-out;
}

@keyframes dialFadeIn {
  0% { opacity: 0; transform: translateY(6px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* 开场引号装饰 */
.msg.char .msg-b.dial::before {
  content: '\201C';
  font-size: 2.8rem;
  position: absolute;
  top: -8px;
  left: 4px;
  color: var(--amber);
  opacity: 0.15;
  font-family: var(--serif);
  line-height: 1;
  pointer-events: none;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   3. 消息类型差异化 — 用户消息增强
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.msg.user .msg-b {
  animation: userMsgIn 0.35s ease-out;
  box-shadow: 0 2px 16px rgba(96,165,250,0.04);
  position: relative;
  overflow: hidden;
}

@keyframes userMsgIn {
  0% { opacity: 0; transform: translateX(16px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* 墨水扩散效果（用户消息右上角装饰） */
.msg.user .msg-b::before {
  content: '';
  position: absolute;
  top: -10px;
  right: -10px;
  width: 40px;
  height: 40px;
  background: radial-gradient(circle, rgba(96,165,250,0.04) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   4. 系统消息 — 卷轴展开动画
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.msg-g {
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.msg-g::before,
.msg-g::after {
  content: '';
  display: inline-block;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
  vertical-align: middle;
  animation: scrollExpand 0.6s ease-out forwards;
}

.msg-g::before { animation-delay: 0.05s; }
.msg-g::after { animation-delay: 0.15s; }

@keyframes scrollExpand {
  0% { width: 0; opacity: 0; }
  100% { width: 40px; opacity: 1; }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   5. 打字机效果
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.msg-b.typewriter {
  position: relative;
  min-height: 1.4em;
}

.tw-content {
  white-space: pre-wrap;
  word-break: break-word;
}

.tw-cursor {
  display: inline;
  animation: twBlink 0.7s step-end infinite;
  color: var(--amber);
  font-weight: 300;
  margin-left: 1px;
  font-size: 1em;
  line-height: 1;
}

.tw-cursor.done {
  display: none;
}

@keyframes twBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   6. 🎲 骰子结果 — 视觉卡片
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.msg-dice {
  display: flex;
  justify-content: center;
  padding: 4px 0 10px;
  animation: diceSlideIn 0.4s ease-out;
}

@keyframes diceSlideIn {
  0% { opacity: 0; transform: translateY(12px) scale(0.92); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.dice-card {
  text-align: center;
  padding: 18px 36px 16px;
  background: radial-gradient(ellipse at center, rgba(212,165,116,0.07), transparent);
  border: 1px solid rgba(212,165,116,0.12);
  border-radius: 18px;
  min-width: 160px;
  position: relative;
  overflow: hidden;
}

/* 流光边框 */
.dice-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  background: conic-gradient(
    from 0deg at 50% 50%,
    transparent,
    rgba(212,165,116,0.08),
    transparent,
    rgba(255,221,153,0.06),
    transparent
  );
  animation: diceBorderGlow 3s linear infinite;
  pointer-events: none;
  border-radius: 18px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  padding: 1px;
}

@keyframes diceBorderGlow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.dice-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 500;
}

.dice-number {
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--candle);
  font-family: var(--serif);
  line-height: 1;
  margin: 2px 0;
  text-shadow: 0 0 30px rgba(255,221,153,0.1);
  min-height: 3.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

/* 大成功 ✨ */
.dice-card.crit .dice-number {
  color: #ffd700;
  text-shadow: 0 0 40px rgba(255,215,0,0.4), 0 0 80px rgba(255,215,0,0.15);
  animation: critPulse 1.2s ease-in-out infinite;
}

@keyframes critPulse {
  0%, 100% { transform: scale(1); text-shadow: 0 0 40px rgba(255,215,0,0.4); }
  50% { transform: scale(1.06); text-shadow: 0 0 60px rgba(255,215,0,0.6), 0 0 100px rgba(255,215,0,0.2); }
}

/* 大失败 💀 */
.dice-card.fail .dice-number {
  color: #ef4444;
  text-shadow: 0 0 30px rgba(239,68,68,0.25);
  animation: failShake 0.5s ease-in-out 3;
}

@keyframes failShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px) rotate(-2deg); }
  75% { transform: translateX(4px) rotate(2deg); }
}

.dice-result-text {
  font-size: 0.82rem;
  color: var(--text-soft);
  margin-top: 4px;
  letter-spacing: 0.5px;
}

.dice-result-text.crit {
  color: #ffd700;
  font-weight: 600;
}

.dice-result-text.fail {
  color: #ef4444;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   7. AI 思考指示器 — 羽毛笔书写
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.thinking {
  position: relative;
  overflow: hidden;
  padding: 10px 20px;
  background: linear-gradient(90deg, transparent, rgba(212,165,116,0.02), transparent);
}

/* 羽毛笔图标动画 */
#thinkAvatar {
  display: none;  /* 隐藏旧的 emoji，我们用新效果替代 */
}

.thinking::before {
  content: '🪶';
  margin-right: 6px;
  animation: featherSway 1.2s ease-in-out infinite;
  display: inline-block;
  font-size: 0.95rem;
}

@keyframes featherSway {
  0%, 100% { transform: rotate(-8deg) translateX(0); }
  50% { transform: rotate(4deg) translateX(3px); }
}

/* 墨水涟漪 dots */
.thinking .dots span {
  width: 5px;
  height: 5px;
  background: var(--amber);
  border-radius: 50%;
  animation: inkRipple 1.4s ease-in-out infinite;
}

.thinking .dots span:nth-child(1) { animation-delay: 0s; }
.thinking .dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking .dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes inkRipple {
  0%, 100% {
    transform: translateY(0) scale(1);
    opacity: 0.25;
  }
  40% {
    transform: translateY(-5px) scale(1.4);
    opacity: 1;
  }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   8. 模式切换过渡动画
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.messages {
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

.messages.mode-changing {
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
}

/* 模式 tab 底部滑动指示条 */
.mt {
  position: relative;
}

.mt-indicator {
  position: absolute;
  bottom: -2px;
  height: 2px;
  background: var(--amber);
  border-radius: 2px;
  transition: left 0.3s ease-out, width 0.3s ease-out;
  pointer-events: none;
  box-shadow: 0 0 12px rgba(212,165,116,0.3);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   9. Toast 增强
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.toast {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.toast.show {
  box-shadow:
    0 8px 40px rgba(0,0,0,0.5),
    0 0 0 1px rgba(212,165,116,0.06),
    0 0 30px rgba(212,165,116,0.04);
}

.toast.success.show {
  border-color: rgba(74,222,128,0.2);
  box-shadow:
    0 8px 40px rgba(0,0,0,0.5),
    0 0 0 1px rgba(74,222,128,0.06),
    0 0 30px rgba(74,222,128,0.04);
}

.toast.error.show {
  border-color: rgba(239,68,68,0.2);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   10. 聊天页面氛围层
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.chat-atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.8s ease-out;
}

.chat-atmosphere.active {
  opacity: 1;
}

.chat-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  animation: atmoPulse ease-in-out infinite alternate;
}

@keyframes atmoPulse {
  0% { opacity: 0.35; transform: scale(1); }
  100% { opacity: 0.6; transform: scale(1.12); }
}

/* 模式专属氛围色 */
.chat-atmosphere.mode-adventure .chat-glow:nth-child(1) {
  background: radial-gradient(circle, rgba(212,165,116,0.08) 0%, transparent 70%);
}
.chat-atmosphere.mode-adventure .chat-glow:nth-child(2) {
  background: radial-gradient(circle, rgba(255,107,53,0.04) 0%, transparent 70%);
}

.chat-atmosphere.mode-character .chat-glow:nth-child(1) {
  background: radial-gradient(circle, rgba(255,221,153,0.07) 0%, transparent 70%);
}
.chat-atmosphere.mode-character .chat-glow:nth-child(2) {
  background: radial-gradient(circle, rgba(212,165,116,0.05) 0%, transparent 70%);
}

.chat-atmosphere.mode-challenge .chat-glow:nth-child(1) {
  background: radial-gradient(circle, rgba(255,107,53,0.06) 0%, transparent 70%);
}
.chat-atmosphere.mode-challenge .chat-glow:nth-child(2) {
  background: radial-gradient(circle, rgba(239,68,68,0.03) 0%, transparent 70%);
}

.chat-atmosphere.mode-group .chat-glow:nth-child(1) {
  background: radial-gradient(circle, rgba(96,165,250,0.05) 0%, transparent 70%);
}
.chat-atmosphere.mode-group .chat-glow:nth-child(2) {
  background: radial-gradient(circle, rgba(212,165,116,0.05) 0%, transparent 70%);
}

.chat-atmosphere.mode-hybrid .chat-glow:nth-child(1) {
  background: radial-gradient(circle, rgba(212,165,116,0.07) 0%, transparent 70%);
}
.chat-atmosphere.mode-hybrid .chat-glow:nth-child(2) {
  background: radial-gradient(circle, rgba(255,221,153,0.04) 0%, transparent 70%);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   11. 消息交错进场 (stagger)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.msg.stagger {
  animation: msgStaggerIn 0.4s var(--ease-out-expo) forwards;
}

@keyframes msgStaggerIn {
  0% { opacity: 0; transform: translateY(12px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   12. 侧边栏对话活性指示点
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.sb-conv.active {
  position: relative;
}

.sb-conv.active::after {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px rgba(212,165,116,0.3);
  animation: activeDot 2s ease-in-out infinite;
}

@keyframes activeDot {
  0%, 100% { opacity: 0.3; transform: translateY(-50%) scale(0.8); }
  50% { opacity: 1; transform: translateY(-50%) scale(1.2); }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   13. 消息时间戳美化
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.msg-time {
  font-size: 0.6rem;
  color: var(--text-muted);
  font-weight: 400;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.msg:hover .msg-time {
  opacity: 1;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   14. 登录弹窗切换 tab 动画辅助
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.auth-tab.active {
  transition: border-color 0.2s ease-out;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   15. 角色选择下拉美化
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.cs {
  cursor: pointer;
  transition: border-color 0.2s ease-out, box-shadow 0.2s ease-out;
}

.cs:hover {
  border-color: rgba(212,165,116,0.2);
}

.cs:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(212,165,116,0.08);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   16. 移动端适配
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

@media (max-width: 768px) {
  .dice-number {
    font-size: 2.4rem;
    min-height: 2.8rem;
  }
  .dice-card {
    padding: 14px 24px;
    min-width: 120px;
  }
  .msg.char .msg-b.narr {
    padding: 10px 14px;
  }
  .msg.char .msg-b.dial {
    padding: 10px 14px 10px 24px;
  }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   17. 🎲 3D CSS 骰子 — 立体旋转骰子
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.dice-3d-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 0 16px;
  flex-direction: column;
  gap: 12px;
}

.dice-3d-scene {
  perspective: 700px;
  width: 110px;
  height: 110px;
}

.dice-3d-cube {
  width: 110px;
  height: 110px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.dice-3d-cube.rolling {
  transition: transform 0.08s linear;
}

.dice-3d-face {
  position: absolute;
  width: 106px;
  height: 106px;
  border: 2px solid rgba(212,165,116,0.25);
  border-radius: 14px;
  background: linear-gradient(145deg, #2c1a12, #1f0f08, #2c1a12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--candle);
  backface-visibility: hidden;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.5);
}

/* 骰子点数 dots layout */
.dice-pip {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--candle), var(--amber));
  box-shadow: 0 0 8px rgba(255,221,153,0.2);
  position: absolute;
}
.pip-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.pip-tl { top: 18%; left: 18%; }
.pip-tr { top: 18%; right: 18%; }
.pip-bl { bottom: 18%; left: 18%; }
.pip-br { bottom: 18%; right: 18%; }
.pip-ml { top: 50%; left: 18%; transform: translateY(-50%); }
.pip-mr { top: 50%; right: 18%; transform: translateY(-50%); }

/* Face positions in 3D space */
.dice-f1 { transform: translateZ(55px); }
.dice-f2 { transform: rotateX(180deg) translateZ(55px); }
.dice-f3 { transform: rotateY(90deg) translateZ(55px); }
.dice-f4 { transform: rotateY(-90deg) translateZ(55px); }
.dice-f5 { transform: rotateX(-90deg) translateZ(55px); }
.dice-f6 { transform: rotateX(90deg) translateZ(55px); }

.dice-3d-result {
  font-size: 2rem;
  font-weight: 700;
  color: var(--candle);
  font-family: var(--serif);
  text-shadow: 0 0 20px rgba(255,221,153,0.15);
  text-align: center;
}

.dice-3d-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 2px;
}

.dice-3d-verdict {
  font-size: 0.85rem;
  text-align: center;
  margin-top: -4px;
}

.dice-3d-wrap.crit .dice-3d-face {
  border-color: rgba(255,215,0,0.3);
  box-shadow: 0 0 30px rgba(255,215,0,0.1), inset 0 0 30px rgba(0,0,0,0.5);
}
.dice-3d-wrap.crit .dice-3d-result {
  color: #ffd700;
  text-shadow: 0 0 30px rgba(255,215,0,0.4);
  animation: dCritPulse 1.2s ease-in-out infinite;
}
@keyframes dCritPulse {
  0%, 100% { transform: scale(1); text-shadow: 0 0 30px rgba(255,215,0,0.4); }
  50% { transform: scale(1.08); text-shadow: 0 0 50px rgba(255,215,0,0.6); }
}

.dice-3d-wrap.fail .dice-3d-face {
  border-color: rgba(239,68,68,0.2);
  box-shadow: 0 0 20px rgba(239,68,68,0.06), inset 0 0 30px rgba(0,0,0,0.5);
}
.dice-3d-wrap.fail .dice-3d-result {
  color: #ef4444;
  text-shadow: 0 0 20px rgba(239,68,68,0.2);
  animation: dFailShake 0.5s ease-in-out 3;
}
@keyframes dFailShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px) rotate(-1deg); }
  75% { transform: translateX(3px) rotate(1deg); }
}

@media (max-width: 768px) {
  .dice-3d-scene { width: 80px; height: 80px; }
  .dice-3d-cube { width: 80px; height: 80px; }
  .dice-3d-face { width: 76px; height: 76px; font-size: 1.8rem; }
  .dice-f1 { transform: translateZ(40px); }
  .dice-f2 { transform: rotateX(180deg) translateZ(40px); }
  .dice-f3 { transform: rotateY(90deg) translateZ(40px); }
  .dice-f4 { transform: rotateY(-90deg) translateZ(40px); }
  .dice-f5 { transform: rotateX(-90deg) translateZ(40px); }
  .dice-f6 { transform: rotateX(90deg) translateZ(40px); }
  .dice-pip { width: 10px; height: 10px; }
  .dice-3d-result { font-size: 1.5rem; }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   18. 🖼️ 角色立绘面板（侧边栏）
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.char-panel-section {
  padding: 12px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 4px;
  animation: panelSlideIn 0.4s ease-out;
}

@keyframes panelSlideIn {
  0% { opacity: 0; transform: translateY(-8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.char-panel {
  display: flex;
  gap: 12px;
  align-items: center;
  background: linear-gradient(135deg, rgba(212,165,116,0.06), rgba(212,165,116,0.01));
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 12px 14px;
  position: relative;
  overflow: hidden;
  cursor: default;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.char-panel:hover {
  border-color: rgba(212,165,116,0.2);
  box-shadow: 0 0 20px rgba(212,165,116,0.03);
}

.char-panel-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(212,165,116,0.08);
  border: 2px solid rgba(212,165,116,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
  transition: transform 0.3s ease-out;
  animation: avatarBreathe 3s ease-in-out infinite;
}

@keyframes avatarBreathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.char-panel-info { flex: 1; min-width: 0; }

.char-panel-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--candle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.char-panel-title {
  font-size: 0.7rem;
  color: var(--text-soft);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.char-panel-mood-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.char-panel-mood {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 50px;
  background: rgba(212,165,116,0.06);
  border: 1px solid rgba(212,165,116,0.08);
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.char-panel-mood.happy { background: rgba(74,222,128,0.06); border-color: rgba(74,222,128,0.1); color: #4ade80; }
.char-panel-mood.sad { background: rgba(96,165,250,0.06); border-color: rgba(96,165,250,0.1); color: #60a5fa; }
.char-panel-mood.angry { background: rgba(239,68,68,0.06); border-color: rgba(239,68,68,0.1); color: #ef4444; }
.char-panel-mood.fear { background: rgba(251,191,36,0.06); border-color: rgba(251,191,36,0.1); color: #fbbf24; }

.char-panel-relation {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.char-panel-relation-bar {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.04);
  border-radius: 2px;
  overflow: hidden;
  max-width: 60px;
}

.char-panel-relation-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--amber), var(--gold));
  transition: width 0.5s ease-out;
}

.char-panel-empty {
  text-align: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 0.78rem;
  border: 1px dashed var(--hairline);
  border-radius: 12px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   19. 🌫️ 聊天区粒子系统
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.chat-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.chat-particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  animation: chatParticleFloat linear infinite;
  will-change: transform, opacity;
}

@keyframes chatParticleFloat {
  0% { transform: translateY(0) translateX(0) scale(1); opacity: 0; }
  10% { opacity: 0.35; }
  70% { opacity: 0.2; }
  100% { transform: translateY(-105vh) translateX(20px) scale(0.6); opacity: 0; }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   20. 📖 书本阅读模式
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.read-book-wrap {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}

.read-book {
  position: relative;
  background: linear-gradient(135deg, rgba(44,26,18,0.3), rgba(31,15,8,0.3));
  border: 1px solid var(--hairline-strong);
  border-radius: 4px 16px 16px 4px;
  padding: 40px 48px;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.3);
  min-height: 300px;
  transition: opacity 0.35s ease-out, transform 0.35s ease-out;
}

/* 书脊 */
.read-book::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 16px;
  background: linear-gradient(90deg, rgba(212,165,116,0.04), transparent);
  border-radius: 4px 0 0 4px;
  pointer-events: none;
}

.read-book.page-turning {
  opacity: 0;
  transform: translateX(-10px) rotateY(3deg);
}
.read-book.page-land {
  opacity: 1;
  transform: translateX(0) rotateY(0);
}

.read-book-header {
  text-align: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--serif);
  color: var(--candle);
}

.read-book-page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
}

.read-page-btn {
  padding: 8px 18px;
  border-radius: 50px;
  border: 1px solid var(--hairline);
  background: rgba(212,165,116,0.04);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.78rem;
  font-family: var(--sans);
  transition: all 0.2s ease-out;
  display: flex;
  align-items: center;
  gap: 6px;
}
.read-page-btn:hover {
  background: rgba(212,165,116,0.1);
  color: var(--amber);
  border-color: rgba(212,165,116,0.2);
}
.read-page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.read-page-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.read-page-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hairline);
  transition: all 0.3s ease-out;
}
.read-page-dot.active {
  background: var(--amber);
  box-shadow: 0 0 6px rgba(212,165,116,0.3);
}

@media (max-width: 768px) {
  .read-book { padding: 20px 24px; }
  .char-panel { padding: 10px 12px; }
  .char-panel-avatar { width: 40px; height: 40px; font-size: 1.3rem; }
}
