/* ============================================================
   IP 互动页专用：舞台 / 立绘 / 3D 画布 / 互动面板 / 吸底输入
   仅在 pages/user/miaoyu.html 加载，首页不引入，控制首屏体积。
   色值与组件全部沿用 yu-base.css。
   ============================================================ */

/* ---------- 与首页共用的一小段基础（本页不加载 home-ip.css） ---------- */
[hidden] { display: none !important; }
.hi-stack { display: flex; flex-direction: column; gap: var(--yu-section-gap); padding-top: var(--yu-space-4); }
.hi-page--top { padding-top: var(--yu-space-4); }
.hi-progress { height: 8px; border-radius: var(--yu-radius-pill); background: var(--yu-cream-deep); overflow: hidden; }
.hi-progress__bar { display: block; height: 100%; border-radius: var(--yu-radius-pill); background: var(--yu-gradient-primary); }
.hi-progress--accent .hi-progress__bar { background: var(--yu-gradient-accent); }
.hi-bar--mini { height: 5px; }
.hi-bar--mini .hi-progress__bar { transition: width .18s var(--yu-ease); }
.hi-bar-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; font-size: 10px; color: var(--yu-text-3); }
.toast-wrap { position: fixed; z-index: 999; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none; }
.toast-item {
  background: rgba(31, 107, 74, .92); color: #fff; padding: 10px 16px; border-radius: 12px;
  font-size: 14px; line-height: 1.4; text-align: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  animation: toastIn .2s ease, toastOut .2s ease 1.5s forwards; max-width: 260px;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(6px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-4px) scale(.98); } }
/* ---------- IP 互动页 ---------- */
.hi-ip-page { padding-bottom: calc(84px + var(--yu-safe-bottom)); }
.hi-stage__mood { text-shadow: 0 1px 8px rgba(15, 56, 39, .35); }
.hi-stage {
  position: relative; overflow: hidden;
  min-height: 300px;
  padding: 14px var(--yu-gutter) 16px;
  border-radius: var(--yu-radius-xl);
  background: var(--yu-gradient-hero);
  color: var(--yu-white);
  box-shadow: 0 12px 28px rgba(31, 107, 74, .16);
}
.hi-stage::before {
  content: ""; position: absolute; right: -74px; top: -86px;
  width: 200px; height: 200px; border-radius: 50%;
  border: 26px solid rgba(255, 255, 255, .06);
}
.hi-stage::after {
  content: ""; position: absolute; left: 18px; bottom: 74px;
  width: 64px; height: 26px;
  background: radial-gradient(circle, rgba(255, 255, 255, .14) 2px, transparent 2.5px);
  background-size: 13px 13px;
  transform: rotate(-12deg);
}
.hi-stage__top { position: relative; z-index: 3; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.hi-stage__3d {
  display: inline-flex; align-items: center; gap: 5px;
  height: 30px; padding: 0 12px;
  border-radius: var(--yu-radius-pill);
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .24);
  color: var(--yu-white);
  font-size: var(--yu-fs-caption); font-weight: 600;
}
.hi-stage__3d--on { background: var(--yu-gradient-accent); border-color: transparent; color: var(--yu-orange-700); }
.hi-stage__state { font-size: var(--yu-fs-micro); line-height: 1.4; opacity: .8; text-align: right; }
.hi-stage__cat {
  position: relative; z-index: 2;
  display: block; width: 208px; max-width: 62%;
  margin: 4px auto 0;
  filter: drop-shadow(0 14px 16px rgba(15, 56, 39, .3));
  animation: yu-breathe 3.6s ease-in-out infinite;
  transform-origin: 50% 94%;
}
.hi-stage__floor {
  position: absolute; left: 50%; bottom: 82px;
  width: 176px; height: 22px; margin-left: -88px;
  border-radius: 50%;
  background: rgba(15, 56, 39, .22);
  filter: blur(4px);
}
.hi-stage__foot { position: relative; z-index: 3; margin-top: 2px; text-align: center; }
.hi-stage__foot::before {
  content: ""; position: absolute; z-index: -1;
  left: -14px; right: -14px; top: -26px; bottom: -16px;
  border-radius: 0 0 var(--yu-radius-xl) var(--yu-radius-xl);
  background: linear-gradient(to top, rgba(15, 56, 39, .58), rgba(15, 56, 39, 0));
  pointer-events: none;
}
.hi-stage__name { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: var(--yu-fs-h3); font-weight: 700; }
.hi-stage__mood { margin-top: 2px; font-size: var(--yu-fs-micro); color: rgba(255, 255, 255, .82); }
.hi-stage__meter {
  width: 74%; margin: 10px auto 0;
  padding: 8px 12px;
  border-radius: var(--yu-radius-pill);
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .18);
}
.hi-stage__meter .hi-progress { height: 6px; background: rgba(255, 255, 255, .24); }
.hi-stage__meter .hi-progress__bar { background: var(--yu-gradient-accent); }
.hi-stage__meter-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; font-size: var(--yu-fs-micro); }

/* 立绘上的动作视频：只在用户触发后播放一次 */
.hi-stage__video {
  position: absolute; inset: 0; z-index: 4;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; pointer-events: none;
  transition: opacity var(--yu-dur) var(--yu-ease);
}
.hi-stage__video.is-play { opacity: 1; }
.hi-stage__cat.is-dim { opacity: .25; }

/* 说话气泡与互动反馈 */
.hi-stage__mood.pop { animation: hi-pop .28s var(--yu-ease); }
@keyframes hi-pop {
  0% { transform: scale(.96); opacity: .55; }
  100% { transform: scale(1); opacity: 1; }
}
.hi-stage__cat.bounce { animation: hi-bounce .5s var(--yu-ease); }
@keyframes hi-bounce {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(1.06) rotate(-2deg); }
  70% { transform: scale(.99) rotate(1deg); }
}
.heart-layer {
  position: absolute; inset: 0; z-index: 6;
  overflow: hidden; pointer-events: none;
}
.float-heart {
  position: absolute; bottom: 34%;
  color: #fff; font-size: 15px; font-weight: 800;
  text-shadow: 0 2px 8px rgba(15, 56, 39, .35);
  white-space: nowrap;
  animation: hi-float .9s ease-out forwards;
}
@keyframes hi-float {
  0% { transform: translateY(0) scale(.9); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateY(-76px) scale(1.08); opacity: 0; }
}

/* 3D 画布 */
.hi-stage__canvas {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%;
  display: none;
}
.hi-stage.is-3d .hi-stage__canvas { display: block; }
.hi-stage.is-3d .hi-stage__cat { visibility: hidden; }

/* 3D 加载态 */
.hi-stage__loading {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 24px;
  background: rgba(15, 56, 39, .74);
  text-align: center;
}
.hi-stage__loading .hi-progress { width: 68%; background: rgba(255, 255, 255, .22); }
.hi-stage__loading .hi-progress__bar { background: var(--yu-gradient-accent); }

/* 快捷动作 */
.hi-acts { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--yu-space-2); }
.hi-act {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 4px; border-radius: var(--yu-radius-md);
  background: var(--yu-surface); border: 1px solid var(--yu-border);
  box-shadow: var(--yu-shadow-xs);
}
.hi-act__ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--yu-primary-soft); color: var(--yu-primary-strong); }
.hi-act__ic--accent { background: var(--yu-orange-soft); color: var(--yu-orange-700); }
.hi-act__tx { font-size: var(--yu-fs-micro); color: var(--yu-text-2); }

/* 互动面板 */
.hi-action-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.hi-action {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 2px; border-radius: var(--yu-radius-md);
  background: var(--yu-surface); border: 1px solid var(--yu-border);
  box-shadow: var(--yu-shadow-xs);
}
.hi-action__ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--yu-orange-soft); font-size: 19px; }
.hi-action__nm { font-size: var(--yu-fs-micro); color: var(--yu-text-2); }
.hi-pet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hi-pet {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 12px 4px; border-radius: var(--yu-radius-md);
  background: var(--yu-orange-soft); border: 1px solid #F0E2D1;
  font-size: var(--yu-fs-micro); color: var(--yu-text);
}
.hi-pet__emoji { font-size: 20px; line-height: 1; }
.hi-feed { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--yu-radius-md); background: var(--yu-surface); border: 1px solid var(--yu-border); box-shadow: var(--yu-shadow-xs); }
.hi-feed + .hi-feed { margin-top: 8px; }
.hi-feed.is-cooling { opacity: .55; }
.hi-feed__ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--yu-orange-soft); font-size: 19px; }

/* 对话 */
.hi-chat-list { display: flex; flex-direction: column; gap: 10px; max-height: 280px; overflow-y: auto; }
.hi-msg { display: flex; align-items: flex-start; gap: 8px; }
.hi-msg--me { flex-direction: row-reverse; }
.hi-msg__avatar {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 50%; overflow: hidden;
  background: var(--yu-orange-soft);
  box-shadow: var(--yu-shadow-xs);
}
.hi-msg__avatar img { width: 100%; height: 100%; object-fit: cover; }
.hi-bubble {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: var(--yu-radius-lg);
  background: var(--yu-white);
  border: 1px solid var(--yu-border);
  box-shadow: var(--yu-shadow-xs);
  font-size: var(--yu-fs-sm); line-height: 1.6;
  word-break: break-word;
}
.hi-msg--cat .hi-bubble { border-top-left-radius: var(--yu-radius-xs); }
.hi-msg--me .hi-bubble {
  background: var(--yu-gradient-primary);
  color: var(--yu-on-primary);
  border-color: transparent;
  border-top-right-radius: var(--yu-radius-xs);
}
.hi-bubble .yu-tag { margin-bottom: 4px; }

/* 快捷问句 */
.hi-quick { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.hi-quick::-webkit-scrollbar { display: none; }

/* 吸底输入 */
.hi-composer {
  position: fixed; z-index: var(--yu-z-tabbar);
  left: 0; right: 0; bottom: 0;
  padding: 10px var(--yu-gutter) calc(10px + var(--yu-safe-bottom));
  background: rgba(255, 255, 255, .96);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--yu-border);
}
.hi-composer__inner { display: flex; align-items: center; gap: 8px; width: 100%; max-width: var(--yu-shell); margin: 0 auto; }
.hi-composer__btn {
  display: grid; place-items: center; flex-shrink: 0;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--yu-bg-sub); color: var(--yu-text-2);
}
.hi-composer__send { background: var(--yu-gradient-accent); color: var(--yu-orange-700); box-shadow: var(--yu-shadow-orange); }
.hi-composer .yu-input { height: 40px; border-radius: var(--yu-radius-pill); }
@media (min-width: 560px) {
  .hi-composer {
    left: 50%; right: auto; width: var(--yu-shell);
    transform: translateX(-50%);
    border-radius: var(--yu-radius-xl) var(--yu-radius-xl) 0 0;
    box-shadow: 0 -10px 34px rgba(86, 62, 34, .10);
  }
}

/* 好感度卡 */
.hi-bar--mini { height: 5px; }
.hi-bar--mini .hi-progress__bar { transition: width .18s var(--yu-ease); }
.hi-bar-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; font-size: 10px; color: var(--yu-text-3); }
@media (max-width: 380px) {
  .hi-stage__cat { width: 184px; }
}

@media (prefers-reduced-motion: reduce) {
  .hi-stage__cat { animation: none !important; }
}
