/* 鱼鱼 · 动效层（规格：yuyu-design/motion/motion.md）
   原则：只给因果加动效；每屏最多两处；不弹不抖；reduced-motion 全退化。
   2026-11-17 口径更新：发送键可摆尾一次；打字态/在线点/空状态鲸鱼可循环。 */

:root {
  --dur-feedback: 120ms;
  --dur-enter: 150ms;
  --dur-screen: 180ms;
  --dur-exit: 110ms;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-swap: cubic-bezier(.4, 0, .2, 1);
}

/* 1 · 发送键：按下/发送成功那一下摆尾，150ms，位移 3px，一次即停 */
@keyframes yy-wag {
  0%   { transform: translateX(0) rotate(0); }
  40%  { transform: translateX(-3px) rotate(-5deg); }
  100% { transform: translateX(0) rotate(0); }
}
.send.is-wag .send-whale { animation: yy-wag 150ms var(--ease-out) 1 both; }

/* 2 · 打字态：三点 1.2s 循环、错峰 120ms；头像呼吸 2px */
@keyframes yy-dot {
  0%, 70%, 100% { transform: translateY(0); opacity: .5; }
  35%           { transform: translateY(-2px); opacity: 1; }
}
.typing-dots { display: inline-flex; align-items: center; gap: 3px; }
.typing-dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .5; display: block; }
.typing.on .typing-dots i { animation: yy-dot 1.2s var(--ease-out) infinite; }
.typing.on .typing-dots i:nth-child(2) { animation-delay: 120ms; }
.typing.on .typing-dots i:nth-child(3) { animation-delay: 240ms; }

@keyframes yy-breathe {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-2px); }
}
.chat-page.her-typing .chat-head .avatar { animation: yy-breathe 1.2s var(--ease-out) infinite; }

/* 3 · 在线点：2s 呼吸，opacity .6 → 1 */
@keyframes yy-online {
  0%, 100% { opacity: .6; }
  50%      { opacity: 1; }
}
.chat-head .who .dot-on { animation: yy-online 2s var(--ease-out) infinite; }

/* 4 · 空状态鲸鱼：3s 浮 3px */
@keyframes yy-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}
.chat-empty img { animation: yy-float 3s var(--ease-out) infinite; }

/* 5 · 气泡入场：对方 150ms（下 4px + scale .98→1），自己 120ms（上 6px，不缩放） */
@keyframes yy-bubble-her {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
@keyframes yy-bubble-me {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.chat-row.her { animation: yy-bubble-her 150ms var(--ease-out) both; }
.chat-row.me  { animation: yy-bubble-me 120ms var(--ease-out) both; }

/* 6 · 列表插入 150ms + 高亮 600ms 渐隐 */
@keyframes yy-row-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}
@keyframes yy-hilite {
  from { background-color: rgba(242, 160, 166, .16); }
  to   { background-color: rgba(242, 160, 166, 0); }
}
.row.fresh { animation: yy-row-in 150ms var(--ease-out) both, yy-hilite 600ms var(--ease-out) 150ms both; }

/* 7 · 图片全屏遮罩淡入 */
@keyframes yy-fade { from { opacity: 0; } to { opacity: 1; } }
.lightbox { animation: yy-fade 150ms var(--ease-out) both; }

/* 8 · 欢迎页鲸鱼：3s 一轮，上下 6px（比空状态大一档，看得见） */
@keyframes yy-float-wide {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.wl-art img { animation: yy-float-wide 3s var(--ease-out) infinite; }

/* 9 · 发送成功后气泡「落」下来一次（160ms） */
@keyframes yy-land {
  from { transform: translateY(-6px) scale(1.02); opacity: .82; }
  to   { transform: none; opacity: 1; }
}
.chat-row.landed .bubble { animation: yy-land 160ms var(--ease-out) both; }

/* 10 · 灰态卡片被点：轻晃一下 120ms */
@keyframes yy-shake {
  0%   { transform: translateX(0); }
  35%  { transform: translateX(-2px); }
  70%  { transform: translateX(2px); }
  100% { transform: translateX(0); }
}

/* 11 · 她的立绘：待机浮动 6px/3s + 呼吸 1.02/4s（相位错开），点一下点头 */
.yy-figure {
  display: inline-block; vertical-align: bottom; line-height: 0;
  aspect-ratio: 640 / 1025;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
}
.yy-figure[data-layers="1"] { aspect-ratio: 576 / 1024; }
.yy-figure .yy-figure-float { position: relative; display: block; width: 100%; height: 100%; animation: yy-figure-float 3s ease-in-out infinite; }
.yy-figure img { display: block; width: 100%; height: 100%; }
.yy-figure .yy-layers {
  position: relative; display: block; width: 100%; height: 100%;
  animation: yy-figure-breathe 4s ease-in-out infinite; animation-delay: -1.6s;
  transform-origin: 50% 62%;
}
.yy-figure .yy-layer { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.yy-figure .yy-eyes, .yy-figure .yy-mouth { opacity: 0; }
.yy-figure .yy-mouth.m0 { opacity: 1; }
.yy-figure[data-layers="0"] img {
  animation: yy-figure-breathe 4s ease-in-out infinite;
  animation-delay: -1.6s;
  transform-origin: 50% 62%;
}
.yy-figure.nodding { animation: yy-figure-nod 320ms var(--ease-out) 1 both; }

/* 眨眼 120ms：闭眼层跳到 1，保持，归 0 */
.yy-figure.blinking .yy-eyes { animation: yy-blink-layer 120ms steps(1, end) 1 both; }

/* 说话 110ms/帧：closed → half → open → half 循环 */
.yy-figure.talking .yy-mouth.m0 { animation: yy-talk-closed 440ms steps(1, end) infinite; }
.yy-figure.talking .yy-mouth.m1 { animation: yy-talk-half 440ms steps(1, end) infinite; }
.yy-figure.talking .yy-mouth.m2 { animation: yy-talk-open 440ms steps(1, end) infinite; }

@keyframes yy-blink-layer {
  0%   { opacity: 0; }
  6%   { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes yy-talk-closed {
  0%, 74% { opacity: 0; }
  75%, 100% { opacity: 1; }
}
@keyframes yy-talk-half {
  0%, 24% { opacity: 1; }
  25%, 49% { opacity: 0; }
  50%, 74% { opacity: 1; }
  75%, 100% { opacity: 0; }
}
@keyframes yy-talk-open {
  0%, 24% { opacity: 0; }
  25%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* 说话时在输入框上方探出的小立绘（平时不占视觉）
   2026-11-17 主人拍板：这个想法先收着，暂时不显示；结构保留，以后要把 display 去掉即可。 */
.yy-talk {
  display: none;
  position: absolute; right: 12px; left: auto; bottom: calc(78px + env(safe-area-inset-bottom));
  width: 56px; z-index: 3; opacity: 0; transform: translateY(8px);
  transition: opacity 150ms cubic-bezier(.2,.8,.2,1), transform 150ms cubic-bezier(.2,.8,.2,1);
  pointer-events: none;
}
.yy-talk.on { opacity: 1; transform: translateY(0); }
.yy-talk .yy-figure { width: 56px; }
body.yy-wall-on .yy-talk { display: none; }
.local-chat .yy-talk { bottom: calc(96px + env(safe-area-inset-bottom)); right: 8px; }

@keyframes yy-figure-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
@keyframes yy-figure-breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.02); }
}
@keyframes yy-figure-nod {
  0%   { transform: rotate(0deg); }
  44%  { transform: rotate(2deg); }
  100% { transform: rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
  .yy-talk { display: none !important; }
  .send.is-wag .send-whale,
  .typing.on .typing-dots i,
  .chat-page.her-typing .chat-head .avatar,
  .chat-head .who .dot-on,
  .chat-empty img,
  .chat-row.her,
  .chat-row.me,
  .chat-row.landed .bubble,
  .row.fresh,
  .lightbox,
  .wl-art img,
  .yy-figure .yy-figure-float,
  .yy-figure img,
  .yy-figure.nodding,
  .yy-figure.talking .yy-mouth,
  .yy-figure.blinking .yy-eyes,
  .entry-card.shake {
    animation: none !important;
  }
}


/* v0.22 语音转写淡入（只给「文字补进来」这一处因果） */
@keyframes yy-vt-in {
  0%   { opacity: 0; transform: translateY(2px); }
  100% { opacity: 1; transform: translateY(0); }
}
.wc-tick { display: none; }
.wall-cell.on .wc-tick {
  display: block; position: absolute; top: 14px; right: 14px; z-index: 3;
  width: 8px; height: 4px; border-left: 1.6px solid #fff; border-bottom: 1.6px solid #fff;
  transform: rotate(-45deg); pointer-events: none;
}
