/* ==========================================================================
   purr-polish.css / PURR（pets-manager-mvp）前端视觉、字体、图标与动效统一升级层
   --------------------------------------------------------------------------
   设计原则：
   - 100% 承接 PURR 拉丝画纸 + 苔藓绿 (#404d3f) + 手绘粉彩图标语言
   - 仅做增量覆盖，不破坏 app.css / purr-shell.css / home-v2.css 原有 DOM 契约
   - 所有新增动效均在末尾提供完整的 prefers-reduced-motion: reduce 退化方案
   ========================================================================== */

:root {
  --purr-font-ui: "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", system-ui, -apple-system, sans-serif;
  --purr-font-serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", Georgia, serif;
  --purr-font-round: "Arial Rounded MT Bold", "Yuanti SC", "PingFang SC", "HarmonyOS Sans SC", ui-rounded, sans-serif;
  --purr-font-num: ui-rounded, "SF Pro Rounded", "DIN Alternate", "HarmonyOS Sans SC", "PingFang SC", sans-serif;

  --ease-paper: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-paw: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-card: cubic-bezier(0.22, 0.85, 0.24, 1);
}

/* ==========================================================================
   1. 字体阶梯：国产机字体栈补齐 + 三档可切换标题气质 + 等宽数字
   ========================================================================== */
body.purr-shell {
  font-family: var(--purr-font-ui);
}

/* 默认方案 A：手账绘本衬线点缀（仅用于大标题与情绪问候，正文保持清晰无衬线） */
html:not([data-purr-font="sans"]):not([data-purr-font="round"]) body.purr-shell :is(
  .identity-heading h1,
  .fd-card-name,
  .diary-t,
  .dbook .dt,
  .purr-studio h1,
  .purr-care-header h1,
  .page-head h1,
  .page-head h2,
  .hv-sec-h
) {
  font-family: var(--purr-font-serif);
  letter-spacing: 0.01em;
}

/* 方案 B：PURR 温润圆体 */
html[data-purr-font="round"] body.purr-shell :is(
  .identity-heading h1,
  .fd-card-name,
  .diary-t,
  .dbook .dt,
  .purr-studio h1,
  .purr-care-header h1,
  .page-head h1,
  .page-head h2,
  .hv-sec-h
) {
  font-family: var(--purr-font-round);
  letter-spacing: -0.01em;
}

/* 数字等宽防抖动 */
body.purr-shell :is(
  .hv-stats .v,
  .hv-rec-big b,
  .hv-rec-sub b,
  .care-time,
  .care-date,
  .purr-care-time,
  .purr-care-date,
  .fd-nav-ix,
  #setBal
) {
  font-family: var(--purr-font-num);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   2. 方向性页面转场（@view-transition）+ 去气泡 blur 卡顿
   ========================================================================== */
html[data-nav-dir="back"]::view-transition-old(root) {
  animation: purr-out-right 220ms var(--ease-paper) both;
}
html[data-nav-dir="back"]::view-transition-new(root) {
  animation: purr-in-left 260ms var(--ease-paper) both;
}
html[data-nav-dir="forward"]::view-transition-old(root) {
  animation: purr-out-left 220ms var(--ease-paper) both;
}
html[data-nav-dir="forward"]::view-transition-new(root) {
  animation: purr-in-right 260ms var(--ease-paper) both;
}
@keyframes purr-out-left  { to { opacity: 0.72; transform: translateX(-18px); } }
@keyframes purr-in-right  { from { opacity: 0.55; transform: translateX(22px); } to { opacity: 1; transform: none; } }
@keyframes purr-out-right { to { opacity: 0.72; transform: translateX(18px); } }
@keyframes purr-in-left   { from { opacity: 0.55; transform: translateX(-22px); } to { opacity: 1; transform: none; } }

/* 去掉微信 WebView 掉帧的 filter: blur(3px)，改为纯 GPU 位移入场 */
.purr-page-chat .bubble.bub-in {
  animation: purr-bubble-clean 240ms var(--ease-paper) both !important;
}
.purr-page-chat .chat.bulk .bubble.bub-in {
  animation: none !important;
}
@keyframes purr-bubble-clean {
  from { opacity: 0; transform: translateY(10px) scale(0.975); }
  to   { opacity: 1; transform: none; }
}

/* 底栏当前项轻弹 */
html body.purr-shell > .app > .tabbar a {
  transition: background-color 180ms var(--ease-paper), color 180ms ease, transform 180ms var(--ease-paw);
}
html body.purr-shell > .app > .tabbar a:active {
  transform: scale(0.94);
}
html body.purr-shell > .app > .tabbar a.on .tb-ic {
  animation: purr-tab-pop 280ms var(--ease-paw);
}
@keyframes purr-tab-pop {
  0%   { transform: scale(0.86); }
  60%  { transform: scale(1.09); }
  100% { transform: scale(1); }
}

/* ==========================================================================
   3. 首页核心升级：图标统一 / 字号与热区修复 / 文件夹微光 / 展开三格可点 / 小票三拍收纸
   ========================================================================== */

/* 3.1 修复首页合上文件夹底部重复漏出「点击打开」灰字 */
body.identity-home #fdRoot.fd-has-cover .fd-hint {
  display: none !important;
}

/* 3.2 文件夹悬浮微光呼吸 + 内页纸片微微探头 */
body.identity-home .fd-front::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  clip-path: path("M20 8 L118 8 Q150 8 172 26 Q184 34 206 34 L260 34 Q280 34 280 54 L280 142 Q280 164 258 164 L22 164 Q0 164 0 142 L0 30 Q0 8 20 8 Z");
  -webkit-clip-path: path("M20 8 L118 8 Q150 8 172 26 Q184 34 206 34 L260 34 Q280 34 280 54 L280 142 Q280 164 258 164 L22 164 Q0 164 0 142 L0 30 Q0 8 20 8 Z");
  background: linear-gradient(112deg, transparent 24%, rgba(255, 251, 238, 0.28) 48%, transparent 74%);
  transform: translateX(-125%);
}
@media (hover: hover) {
  body.identity-home #fdRoot:not(.fd-open) .fd-folder:hover .fd-front::after {
    animation: purr-sheen 820ms var(--ease-paper) forwards;
  }
  body.identity-home #fdRoot:not(.fd-open) .fd-folder:hover .fd-sheet-photo {
    transform: translate(-3px, -5px) rotate(-2deg);
  }
  body.identity-home #fdRoot:not(.fd-open) .fd-folder:hover .fd-sheet-notes {
    transform: translate(3px, -4px) rotate(1.8deg);
  }
}
body.identity-home .fd-sheet-photo,
body.identity-home .fd-sheet-notes {
  transition: transform 380ms var(--ease-paw);
}
@keyframes purr-sheen {
  from { transform: translateX(-115%); }
  to   { transform: translateX(125%); }
}

/* 翻卡导航按钮矢量对齐与灵动回弹 */
body.identity-home .fd-nav-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-color: var(--purr-line);
  background: var(--purr-surface);
  color: var(--purr-icon-ink, #514138);
  transition: transform 180ms var(--ease-paw), background-color 180ms ease;
}
body.identity-home .fd-nav-btn:active { transform: scale(0.9); }
body.identity-home .fd-nav-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
body.identity-home .fd-nav-close {
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--purr-line);
  background: var(--purr-surface);
  color: var(--purr-muted);
  font: inherit;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  transition: transform 180ms var(--ease-paw), background-color 180ms ease;
}
body.identity-home .fd-nav-close:active { transform: scale(0.94); }

/* 3.3 首页问候内联切宠 + 放大柔和化「修改档案」胶囊（告别 9px 蚂蚁字） */
body.identity-home .identity-heading.hv-greet {
  position: relative;
}
body.identity-home .hv-greet-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 2px;
  margin-left: -2px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background-color 180ms ease;
}
body.identity-home .hv-greet-trigger:active,
body.identity-home .hv-greet-trigger:hover {
  background: rgba(111, 87, 65, 0.08);
}
body.identity-home .hv-greet-chev {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(81, 65, 56, 0.08);
  color: var(--purr-icon-ink, #514138);
  transition: transform 200ms var(--ease-paper);
}
body.identity-home .hv-greet-chev svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
body.identity-home .hv-greet-trigger[aria-expanded="true"] .hv-greet-chev {
  transform: rotate(180deg);
}

/* 内联切宠浮层 */
.hv-pet-pop {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  min-width: 224px;
  max-width: 272px;
  padding: 6px;
  border-radius: 18px;
  background: rgba(249, 247, 239, 0.97);
  border: 1px solid var(--purr-line);
  box-shadow: 0 16px 36px -12px rgba(42, 36, 26, 0.25);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 45;
  transform-origin: top left;
  opacity: 0;
  transform: translateY(-6px) scale(0.95);
  pointer-events: none;
  transition: opacity 200ms var(--ease-paper), transform 230ms var(--ease-paw);
}
.hv-pet-pop.open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.hv-pet-opt {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 7px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--purr-ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms ease;
}
.hv-pet-opt:hover { background: var(--purr-tint); }
.hv-pet-opt.on { background: var(--purr-current-tab); }
.hv-pet-opt-ava {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: var(--purr-tint);
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 16px;
}
.hv-pet-opt-ava img { width: 100%; height: 100%; object-fit: cover; }
.hv-pet-opt-ava svg { width: 17px; height: 17px; fill: var(--purr-accent); }
.hv-pet-opt-txt { flex: 1; min-width: 0; }
.hv-pet-opt-txt b { display: block; font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hv-pet-opt-txt small { display: block; font-size: 11px; color: var(--purr-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hv-pet-opt-tick { color: var(--purr-accent); font-weight: 800; font-size: 13px; }
.hv-pet-add {
  margin-top: 4px;
  border-top: 1px solid var(--purr-line);
  border-radius: 0 0 11px 11px;
  color: var(--purr-accent);
  font-size: 12.5px;
  font-weight: 680;
  justify-content: center;
}

/* 修改档案胶囊：32px 柔和圆润胶囊 + 12px 清晰文字（不再是 9px 蚂蚁字） */
body.identity-home .hv-pill {
  height: 32px;
  min-height: 32px;
  padding: 0 12px 0 6px;
  gap: 5px;
  border-color: var(--purr-line);
  background: var(--purr-surface);
  color: var(--purr-ink);
  font-size: 12px;
  font-weight: 650;
  box-shadow: 0 3px 8px rgba(42, 40, 30, 0.06);
}
body.identity-home .hv-pill-ico {
  width: 22px;
  height: 22px;
  background: var(--purr-tint);
  color: var(--purr-icon-ink, #514138);
}
body.identity-home .hv-pill-ico svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 2;
}

/* 3.4 首页输入框 16px 防 iOS 缩放 + 苔藓绿小爪印发送钮 */
body.identity-home #heroActs .ask-bar {
  background: var(--purr-surface) !important;
  border: 1px solid var(--purr-line) !important;
  border-radius: 18px;
  box-shadow: 0 6px 18px -12px rgba(42, 40, 30, 0.16);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
body.identity-home #heroActs .ask-bar:focus-within {
  border-color: var(--purr-accent) !important;
  box-shadow: 0 0 0 3px rgba(64, 77, 63, 0.10) !important;
}
body.identity-home .ask-in {
  font-size: 16px !important;
  color: var(--purr-ink);
}
body.identity-home .ask-in::placeholder {
  font-size: 13.5px;
  color: #939589;
}
body.identity-home #heroActs .ask-go {
  background: var(--purr-accent) !important;
  color: var(--purr-surface) !important;
  border-radius: 13px;
  transition: transform 180ms var(--ease-paw), background-color 160ms ease;
}
body.identity-home #heroActs .ask-go:active {
  transform: scale(0.91);
  background: var(--purr-pressed) !important;
}
body.identity-home #heroActs .ask-go svg.purr-paw-send {
  width: 20px;
  height: 20px;
  fill: currentColor;
  stroke: none;
}

/* 3.5 展开身份卡三格全部升级为可交互按钮 + 数字分级 */
body.identity-home .hv-stats {
  border-color: var(--purr-line);
  background: var(--purr-surface);
}
body.identity-home .hv-stats .st {
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
  padding: 8px 4px 8px 7px;
  transition: background-color 160ms ease;
}
body.identity-home .hv-stats .st:hover,
body.identity-home .hv-stats .st:active {
  background: var(--purr-tint);
}
body.identity-home .hv-stats .v {
  font-size: 13.5px;
  font-weight: 780;
  color: var(--purr-ink);
}
body.identity-home .hv-stats .n {
  font-size: 9.5px;
  color: var(--purr-accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.identity-home .hv-stats .v.purr-num-bump {
  animation: purr-num-bump 340ms var(--ease-paw);
}
@keyframes purr-num-bump {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.18); color: var(--purr-accent); }
  100% { transform: scale(1); }
}

/* 让记体重面板 #wSheet 在首页可正常打开（原先 home-v2.css 把 .mini 全隐藏了） */
body.identity-home #wSheet:not([hidden]) {
  display: flex !important;
}
.w-stepper-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.w-step-btn {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--purr-line);
  background: var(--purr-tint);
  color: var(--purr-accent);
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
  transition: transform 160ms var(--ease-paw), background-color 160ms ease;
}
.w-step-btn:active { transform: scale(0.92); }
#wSvg polyline {
  stroke: var(--purr-accent) !important;
  stroke-dasharray: 420;
  stroke-dashoffset: 0;
}
#wSvg.purr-draw polyline {
  animation: purr-draw-line 640ms var(--ease-paper) both;
}
@keyframes purr-draw-line {
  from { stroke-dashoffset: 420; }
  to   { stroke-dashoffset: 0; }
}

/* 3.6 养宠日记卡：换上 PURR 手绘粉彩爱心手账本（替代硬黑方框白线书） */
body.identity-home .diary-card,
body.identity-home #pdDiary {
  border-radius: 18px;
  transition: transform 180ms var(--ease-paw), border-color 180ms ease;
}
body.identity-home .diary-card:active,
body.identity-home #pdDiary:active {
  transform: scale(0.985);
}
body.identity-home .diary-ico {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 11px;
  background: var(--purr-tint) !important;
  color: var(--purr-icon-ink, #514138);
}
body.identity-home .diary-ico .purr-chrome-icon {
  width: 25px;
  height: 25px;
  stroke: currentColor;
  filter: drop-shadow(0 1px 1px rgba(84, 63, 46, 0.14));
}
body.identity-home .diary-t { font-size: 14.5px; font-weight: 720; }
body.identity-home .diary-s { font-size: 12px; }

/* 3.7 快捷创作 4 格：升级为 PURR 手绘粉彩图标 + 柔和纸面卡片 */
body.identity-home .quickbar a,
body.identity-home .quickbar a + a {
  background: var(--purr-surface);
  border: 1px solid var(--purr-line);
  border-radius: 18px;
  color: var(--purr-ink);
  font-size: 11.5px;
  font-weight: 600;
  transition: transform 180ms var(--ease-paw), border-color 180ms ease, box-shadow 180ms ease;
}
body.identity-home .quickbar a:active { transform: scale(0.94); }
body.identity-home .quickbar svg.purr-chrome-icon {
  width: 28px;
  height: 28px;
  color: var(--purr-icon-ink, #514138);
  stroke: currentColor;
  stroke-width: 1.65;
  filter: drop-shadow(0 1px 1px rgba(84, 63, 46, 0.14));
}

/* 3.8 波浪小票今日提醒：三拍打勾收纸动效 + 更舒适字号 */
body.identity-home #homeCare .care-t {
  position: relative;
  font-size: 13.5px;
  font-weight: 540;
  color: var(--purr-ink);
  transition: color 220ms ease;
}
body.identity-home #homeCare .care-time,
body.identity-home #homeCare .care-date {
  font-size: 11.5px;
  color: var(--purr-muted);
}
body.identity-home #homeCare .care-row-btn {
  transition: opacity 250ms var(--ease-paper), transform 280ms var(--ease-paper), max-height 300ms var(--ease-paper);
  max-height: 54px;
  overflow: hidden;
}
body.identity-home #homeCare .care-ico {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-color: #c8c4b6;
  background: #fffdf8;
  transition: background-color 180ms ease, border-color 180ms ease, transform 220ms var(--ease-paw);
}
body.identity-home #homeCare .care-ico .purr-chk-svg {
  display: block !important;
  width: 13px;
  height: 13px;
  fill: none;
  stroke: #fffdf8;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
body.identity-home #homeCare .care-ico .purr-chk-svg path {
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
}
body.identity-home #homeCare .care-t::after {
  content: "";
  position: absolute;
  left: 0;
  top: 52%;
  width: 100%;
  height: 1.5px;
  background: var(--purr-muted);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 240ms var(--ease-paper);
}
body.identity-home #homeCare .care-row-btn.purr-checking .care-ico {
  background: var(--purr-accent);
  border-color: var(--purr-accent);
  transform: scale(1.16);
}
body.identity-home #homeCare .care-row-btn.purr-checking .care-ico .purr-chk-svg path {
  animation: purr-draw-chk 220ms var(--ease-paper) forwards;
}
@keyframes purr-draw-chk { to { stroke-dashoffset: 0; } }
body.identity-home #homeCare .care-row-btn.purr-checking .care-t {
  color: var(--purr-muted);
}
body.identity-home #homeCare .care-row-btn.purr-checking .care-t::after {
  transform: scaleX(1);
}
body.identity-home #homeCare .care-row-btn.purr-folding {
  opacity: 0;
  transform: translateY(-6px);
  max-height: 0;
  min-height: 0;
  height: 0;
  border-bottom-color: transparent;
}

/* ==========================================================================
   4. 创作流程升级：修复禁用按钮深绿穿帮 + 流光解禁 + 叠卡甩牌 + 伸缩胶囊点 + 弹层退场
   ========================================================================== */

/* 修复实测抓到的 Bug：未上传图片时禁用按钮被 .studio-primary 盖成深绿 */
.purr-studio .studio-primary.avatar-gen-btn:disabled,
.purr-studio .avatar-gen-btn:not(.ready) {
  border-color: #d9d7c9;
  background: #e3dfd2;
  color: #9e9f94;
  cursor: not-allowed;
  box-shadow: none;
}
.purr-studio .studio-primary.avatar-gen-btn.ready {
  position: relative;
  overflow: hidden;
  border-color: var(--purr-accent);
  background: var(--purr-accent);
  color: #fffaf2;
  cursor: pointer;
  box-shadow: 0 8px 18px -10px rgba(49, 61, 49, 0.55);
  transition: background-color 260ms ease, color 260ms ease, transform 220ms var(--ease-paw);
}
.purr-studio .studio-primary.avatar-gen-btn.just-ready {
  animation: purr-ready-pop 440ms var(--ease-paw);
}
.purr-studio .studio-primary.avatar-gen-btn.just-ready::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(112deg, transparent 20%, rgba(255, 250, 236, 0.42) 50%, transparent 80%);
  animation: purr-sheen 740ms ease-out forwards;
}
@keyframes purr-ready-pop {
  0%   { transform: scale(0.96); }
  55%  { transform: scale(1.03); }
  100% { transform: scale(1); }
}

/* 样片叠卡：支持跟手拖拽倾斜 + 飞牌切卡 + 伸缩进度胶囊点 */
.purr-studio :is(.mood-card, .pack-card, .avatar-card).purr-dragging {
  transition: none !important;
}
.purr-studio :is(.mood-card, .pack-card, .avatar-card).purr-fly-left {
  transform: translate(-250px, -16px) rotate(-18deg) scale(0.9) !important;
  opacity: 0 !important;
  transition: transform 220ms var(--ease-paper), opacity 190ms ease !important;
}
.purr-studio :is(.mood-card, .pack-card, .avatar-card).purr-fly-right {
  transform: translate(250px, -16px) rotate(18deg) scale(0.9) !important;
  opacity: 0 !important;
  transition: transform 220ms var(--ease-paper), opacity 190ms ease !important;
}
.purr-studio :is(.mood-dots, .pack-dots, .avatar-dots) i {
  border-radius: 999px;
  transition: width 240ms var(--ease-paper), background-color 240ms ease, transform 240ms ease;
}
.purr-studio :is(.mood-dots, .pack-dots, .avatar-dots) i.on {
  width: 20px;
  transform: none;
}

/* 上传选择弹层：平滑进出场 */
.purr-studio .avatar-sheet-mask {
  display: flex;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms var(--ease-paper), visibility 0s linear 240ms;
}
.purr-studio .avatar-sheet-mask.show {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition: opacity 220ms var(--ease-paper), visibility 0s;
}
.purr-studio .avatar-sheet {
  animation: none;
  transform: translateY(100%);
  transition: transform 280ms var(--ease-paper);
}
.purr-studio .avatar-sheet-mask.show .avatar-sheet {
  transform: translateY(0);
}
.purr-studio .avatar-uploaded.show {
  animation: purr-up-pop 280ms var(--ease-paw) both;
}
@keyframes purr-up-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

/* ==========================================================================
   5. AI 助手升级：自适应多行 textarea / 快捷提问胶囊 / 确认卡盖章折叠 / Lightbox
   ========================================================================== */
.purr-page-chat .composer {
  align-items: flex-end;
}
.purr-page-chat .composer textarea#input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--purr-ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.42;
  resize: none;
  min-height: 40px;
  max-height: 104px;
  padding: 9px 4px;
  outline: none;
}
.purr-page-chat .composer textarea#input::placeholder {
  color: var(--purr-muted);
}
.purr-page-chat .composer .plus {
  display: inline-grid;
  place-items: center;
  padding: 0;
}
.purr-page-chat .composer .plus svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* 快捷提问胶囊 */
.purr-chat-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: -2px;
  animation: purr-bubble-clean 280ms var(--ease-paper) both;
}
.purr-chat-prompt {
  min-height: 36px;
  padding: 6px 13px;
  border: 1px solid var(--purr-line);
  border-radius: 999px;
  background: var(--purr-surface);
  color: var(--purr-accent);
  font: inherit;
  font-size: 12.5px;
  font-weight: 620;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(55, 49, 38, 0.05);
  transition: transform 160ms var(--ease-paw), background-color 160ms ease;
}
.purr-chat-prompt:active {
  transform: scale(0.95);
  background: var(--purr-tint);
}

/* 记录确认卡盖章折叠动效 */
.rec-card.purr-stamping {
  transform: scale(0.94);
  opacity: 0.45;
  transition: transform 200ms var(--ease-paper), opacity 180ms ease;
}
.note-tag.purr-stamped,
.purr-stamp-pill {
  animation: purr-stamp-pop 340ms var(--ease-paw) both;
}
@keyframes purr-stamp-pop {
  0%   { opacity: 0; transform: scale(1.18) rotate(-1.5deg); }
  65%  { opacity: 1; transform: scale(0.97) rotate(0.4deg); }
  100% { opacity: 1; transform: none; }
}

/* ==========================================================================
   6. 全站统一浮层进退场（抽屉 / 弹窗 / Toast / Lightbox / 危险操作 4 秒倒计时条）
   ========================================================================== */

/* 侧边抽屉完整滑入与滑出 */
.drawer:not([hidden]) .drawer-mask {
  animation: purr-fade-in 220ms var(--ease-paper) both;
}
.drawer:not([hidden]) .drawer-panel {
  animation: purr-drawer-in 280ms var(--ease-paper) both;
}
.drawer.is-closing .drawer-mask {
  animation: purr-fade-out 210ms var(--ease-paper) forwards;
}
.drawer.is-closing .drawer-panel {
  animation: purr-drawer-out 240ms var(--ease-paper) forwards;
}
@keyframes purr-fade-in    { from { opacity: 0; } to { opacity: 1; } }
@keyframes purr-fade-out   { from { opacity: 1; } to { opacity: 0; } }
@keyframes purr-drawer-in  { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes purr-drawer-out { from { transform: none; } to { transform: translateX(-100%); } }

/* 抽屉关闭图标矢量居中 */
.drawer-x {
  display: inline-grid;
  place-items: center;
  padding: 0;
}
.drawer-x svg {
  width: 20px;
  height: 20px;
}

/* 危险操作 4 秒倒计时进度条 */
.drawer-link.danger,
.btn-ghost.danger,
.work-del,
#clearWorks,
#phClear,
#bkRestore,
#delAcc {
  position: relative;
  overflow: hidden;
}
:is(.drawer-link.danger, #clearWorks, #phClear, #bkRestore, #delAcc).armed::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(168, 70, 56, 0.16);
  transform-origin: left center;
  pointer-events: none;
  animation: purr-armed-drain var(--armed-dur, 4000ms) linear forwards;
}
@keyframes purr-armed-drain {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* Toast 平滑进出场 + 可选撤销按钮 */
.toast {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(92vw, 380px);
  border-radius: 14px;
  background: rgba(38, 41, 36, 0.94);
  color: #fffdf7;
  box-shadow: 0 12px 28px -10px rgba(24, 24, 20, 0.45);
  animation: purr-toast-in 240ms var(--ease-paw) both;
}
.toast[hidden] { display: none !important; }
.toast-undo-btn {
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.17);
  color: #f4dca6;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
}
@keyframes purr-toast-in {
  from { opacity: 0; transform: translate(-50%, 10px) scale(0.95); }
  to   { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* 页内图片 Lightbox */
.purr-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 19, 16, 0.86);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms var(--ease-paper), visibility 0s linear 240ms;
}
.purr-lightbox.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 220ms var(--ease-paper), visibility 0s;
}
.purr-lightbox img {
  max-width: 100%;
  max-height: 82vh;
  border-radius: 16px;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.45);
  transform: scale(0.92);
  transition: transform 260ms var(--ease-paw);
}
.purr-lightbox.open img { transform: scale(1); }
.purr-lightbox-close {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: 18px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.purr-lightbox-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* 照护日历：修掉 #new 跳转时 h2 程序聚焦留下的突兀外框 */
.purr-care #care-form-title:focus:not(:focus-visible),
.purr-studio h1:focus:not(:focus-visible),
#detail-title:focus:not(:focus-visible) {
  outline: none;
}

/* ==========================================================================
   6.5 首页原暖油画大底色 + 三页卡册默认展开 + 下滑合上视差 + 封面收进导航栏 + 3 层层级
   ========================================================================== */

/* 无宠物空态：隐藏导航栏收容胶囊与层级标签，保持干净「+ 建立档案」空态 */
body.identity-home:not(.hv-has-pet) #hvNavDock,
body.identity-home:not(.hv-has-pet) .hv-tier-label {
  display: none !important;
}
body.identity-home:not(.hv-has-pet) .hv-tier-more {
  background: transparent;
  border: 0;
  padding: 0;
  box-shadow: none;
  backdrop-filter: none;
}

/* 顶部导航栏：默认通透融于暖油画底纹；下滑后渐变为暖纸毛玻璃并承接迷你宠物封面 */
body.identity-home.hv-has-pet > .app > .topbar {
  border-bottom: 1px solid transparent;
  transition: background-color 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}
body.identity-home.hv-has-pet > .app > .topbar.hv-top-docked {
  background: rgba(249, 247, 239, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom-color: rgba(217, 215, 201, 0.78);
  box-shadow: 0 6px 20px -14px rgba(42, 40, 30, 0.22);
}
body.identity-home.hv-has-pet > .app > .topbar.hv-top-docked::before {
  display: none;
}
body.identity-home.hv-has-pet > .app > .topbar.hv-top-docked .top-plus span {
  display: none;
}
body.identity-home.hv-has-pet > .app > .topbar.hv-top-docked .top-plus {
  width: 38px;
  min-width: 38px;
  padding: 0;
  border-radius: 999px;
}

/* 导航栏中央：下滑后收进来的迷你宠物封面胶囊 */
.hv-nav-dock {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 58%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 5px;
  border: 1px solid rgba(217, 215, 201, 0.9);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.92);
  color: var(--purr-ink);
  font: inherit;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 4px 14px -8px rgba(42, 40, 30, 0.24);
  will-change: transform, opacity;
}
.hv-dock-thumb {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  background: var(--purr-tint);
  border: 1px solid rgba(81, 65, 56, 0.14);
  display: grid;
  place-items: center;
  font-size: 14px;
}
.hv-dock-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hv-dock-txt {
  min-width: 0;
  text-align: left;
  line-height: 1.15;
}
.hv-dock-txt b {
  display: block;
  font-size: 13px;
  font-weight: 760;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hv-dock-txt small {
  display: block;
  font-size: 10px;
  color: var(--purr-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Layer 1：三页卡册舞台（位于原暖油画大底色之上，下滑视差慢滚，下拉放大弹性回弹） */
body.identity-home.hv-has-pet #petIdCollection {
  position: relative;
  z-index: 2;
  will-change: opacity;
}
body.identity-home.hv-has-pet #fdViewport {
  transform-origin: 50% 18%;
  will-change: transform;
  overflow: visible !important;
}
body.identity-home.hv-has-pet #fdViewport.hv-snapping {
  transition: transform 480ms cubic-bezier(0.22, 1.26, 0.36, 1), height 420ms var(--ease-paper);
}
body.identity-home.hv-has-pet #fdPortrait0 img,
body.identity-home.hv-has-pet #fdPortrait1 img {
  transform-origin: 50% 35%;
  will-change: transform;
}
body.identity-home.hv-has-pet #fdPortrait0 img.hv-snapping,
body.identity-home.hv-has-pet #fdPortrait1 img.hv-snapping {
  transition: transform 480ms cubic-bezier(0.22, 1.26, 0.36, 1);
}
/* 滚屏触发自动合上时，关闭 height 收缩动画避免跳屏，同时让合上的文件夹自然下沉贴近前景内容，消除中部空洞 */
body.identity-home.hv-scroll-folded #fdViewport {
  transition: none !important;
}
body.identity-home.hv-has-pet .fd-folder-wrap {
  transition: transform 460ms var(--ease-paper);
}
body.identity-home.hv-scroll-folded .fd-folder-wrap {
  transform: translate3d(-50%, 148px, 0);
}

/* Layer 2 & 3：前景内容层（z-index 高于卡册，滚动时顺滑划过视差慢滚的档案区，拉出清晰三层纵深） */
.hv-content-layer {
  position: relative;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 6px;
}
.hv-tier {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hv-tier-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--purr-muted);
  padding: 0 4px;
}
.hv-tier-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(81, 65, 56, 0.14), transparent);
}

/* Tier 2：前景核心行动区（更高纯度暖白卡片 + 清晰投影，成为视觉第一重心） */
.hv-tier-core #heroActs,
.hv-tier-core #homeCareSec {
  margin: 0 !important;
}
body.identity-home.hv-has-pet .hv-tier-core #heroActs .ask-bar {
  background: #fffdf8 !important;
  box-shadow: 0 12px 28px -18px rgba(42, 36, 26, 0.28), inset 0 1px 0 #ffffff;
}
body.identity-home.hv-has-pet .hv-tier-core .hv-receipt {
  filter: drop-shadow(0 14px 26px rgba(42, 36, 26, 0.12));
}

/* Tier 3：次级半透明暖砂纸托架（退后半层，同时透出 PURR 原版拉丝油画底色） */
.hv-tier-more {
  padding: 15px 14px 16px;
  border-radius: 24px;
  background: rgba(235, 229, 214, 0.54);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(217, 215, 201, 0.72);
  box-shadow: inset 0 2px 8px -5px rgba(56, 48, 34, 0.12);
}
.hv-tier-more #pdDiary {
  margin: 0 !important;
  background: rgba(255, 253, 248, 0.92);
  position: relative;
  overflow: hidden;
}
/* 养宠日记卡右下角微卷角提示：暗示「从右下角掀开一张纸」 */
body.identity-home .hv-diary-peelable::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 22px;
  height: 22px;
  background: linear-gradient(315deg, rgba(226, 220, 204, 0.95) 48%, rgba(255, 253, 248, 0.98) 50%, #e5dec9 100%);
  border-top-left-radius: 7px;
  box-shadow: -2px -2px 5px rgba(56, 48, 34, 0.10);
  transition: width 220ms var(--ease-paper), height 220ms var(--ease-paper);
  pointer-events: none;
}
body.identity-home .hv-diary-peelable:hover::after,
body.identity-home .hv-diary-peelable:active::after {
  width: 30px;
  height: 30px;
}

/* 首页独立仪式感按钮：「查看 {用户名}和{宠物名} 的时光手札」实体书入口 */
.hv-book-ritual {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: 16px;
  text-decoration: none;
  color: var(--purr-ink);
  background:
    repeating-linear-gradient(90deg, rgba(81, 65, 56, 0.03) 0 1px, transparent 1px 4px),
    linear-gradient(135deg, rgba(235, 229, 214, 0.92), rgba(224, 217, 200, 0.86));
  border: 1px solid rgba(138, 127, 107, 0.34);
  box-shadow: 0 6px 16px -12px rgba(48, 42, 30, 0.35), inset 0 1px 0 rgba(255, 253, 248, 0.72);
  transition: transform 180ms var(--ease-paw), border-color 180ms ease;
}
.hv-book-ritual:hover { border-color: var(--purr-accent); }
.hv-book-ritual:active { transform: scale(0.985); }
.hv-book-ico {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 11px;
  background: rgba(255, 253, 248, 0.78);
  border: 1px solid rgba(81, 65, 56, 0.14);
  display: grid;
  place-items: center;
  color: var(--purr-icon-ink, #514138);
}
.hv-book-ico svg { width: 22px; height: 22px; }
.hv-book-txt { flex: 1; min-width: 0; }
.hv-book-txt b {
  display: block;
  font-family: var(--purr-font-display, "Songti SC", serif);
  font-size: 13.8px;
  font-weight: 700;
  line-height: 1.32;
  color: var(--purr-ink);
  white-space: normal;
}
.hv-book-txt small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--purr-muted);
}
.hv-book-tag {
  flex: none;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--purr-accent);
  color: #fffaf2;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* 全屏「从右下角掀开一张纸」进入当日手账转场层 */
.purr-peel-stage {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  overflow: hidden;
}
.purr-peel-under {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(81, 65, 56, 0.06) 27px 28px),
    #faf7ee;
  clip-path: polygon(100% 100%, 100% 100%, 100% 100%);
  transition: clip-path 420ms cubic-bezier(0.22, 1, 0.36, 1);
}
.purr-peel-stage.is-peeling .purr-peel-under {
  clip-path: polygon(100% 100%, -95% 100%, 100% -95%);
}
.purr-peel-sheet {
  position: absolute;
  inset: 0;
}
.purr-peel-curl {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 64px;
  height: 64px;
  border-top-left-radius: 18px;
  background: linear-gradient(135deg, #fffdf8 0%, #ede6d4 52%, #d8cfba 100%);
  box-shadow: -16px -16px 34px rgba(38, 33, 24, 0.28);
  transform-origin: 100% 100%;
  transform: translate3d(28px, 28px, 0) scale(0.5);
  opacity: 0.96;
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1), opacity 420ms ease;
}
.purr-peel-stage.is-peeling .purr-peel-curl {
  transform: translate3d(-110vw, -110vh, 0) scale(7.5) rotate(-6deg);
  opacity: 0.92;
}

.hv-tier-more #hvQuickToggle {
  margin-top: 4px !important;
}

/* ==========================================================================
   7. 减弱动态效果完整回退（prefers-reduced-motion: reduce）
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root),
  .purr-page-chat .bubble.bub-in,
  html body.purr-shell > .app > .tabbar a.on .tb-ic,
  body.identity-home .fd-front::after,
  #wSvg.purr-draw polyline,
  .purr-studio .studio-primary.avatar-gen-btn.just-ready,
  .purr-studio .studio-primary.avatar-gen-btn.just-ready::after,
  .drawer:not([hidden]) .drawer-mask,
  .drawer:not([hidden]) .drawer-panel,
  .drawer.is-closing .drawer-mask,
  .drawer.is-closing .drawer-panel,
  .toast,
  .note-tag.purr-stamped {
    animation: none !important;
  }
  .hv-pet-pop,
  body.identity-home.hv-has-pet #fdViewport.hv-snapping,
  body.identity-home.hv-has-pet #fdPortrait0 img.hv-snapping,
  body.identity-home.hv-has-pet #fdPortrait1 img.hv-snapping,
  .hv-nav-dock,
  .purr-studio .avatar-sheet-mask,
  .purr-studio .avatar-sheet,
  .purr-lightbox,
  .purr-lightbox img,
  body.identity-home .fd-sheet-photo,
  body.identity-home .fd-sheet-notes,
  body.identity-home #homeCare .care-row-btn,
  body.identity-home #homeCare .care-ico,
  body.identity-home #homeCare .care-t::after {
    transition: none !important;
  }
}
