/* ==========================================================
   宠物系统：全站悬浮陪伴 / 粮食掉落 / 喂养面板
   仅作用于前台（由 portal-footer 片段引入），配色走主题变量
   ========================================================== */

/* 宠物尺寸同时应用到悬浮宠物、主页和喂食面板 */
:root {
	--pet-fab-size: 72px;
	--pet-home-size: 204px;
	--pet-panel-size: 94px;
}
:root[data-pet-size="small"] {
	--pet-fab-size: 52px;
	--pet-home-size: 148px;
	--pet-panel-size: 70px;
}
:root[data-pet-size="large"] {
	--pet-fab-size: 100px;
	--pet-home-size: 258px;
	--pet-panel-size: 114px;
}

.pet-fab {
	position: fixed;
	left: 16px;
	/* 老内核（Chrome 69 以下）不认 env()，整条 calc 会被丢弃，先留一条纯 px 兜底 */
	bottom: 66px;
	/* 底部导航在 iOS 上会加高一个 Home 指示条安全区，球跟着上移才不会压在导航上；
	   Android WebView 下 env() 恒为 0，等于原来的 66px */
	bottom: calc(66px + env(safe-area-inset-bottom, 0px));
	width: var(--pet-fab-size);
	height: var(--pet-fab-size);
	max-width: calc(100vw - 16px);
	max-height: calc(100vh - 82px);
	padding: 0;
	border-radius: 0;
	background: none;
	border: none;
	box-shadow: none;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	z-index: 1305;
	cursor: grab;
	touch-action: none;
	-webkit-user-select: none;
	user-select: none;
	opacity: .82;
	transition: box-shadow .2s, opacity .2s;
}
.pet-fab:hover, .pet-fab:focus-visible, .pet-fab.dragging { opacity: 1; }
.pet-fab:focus-visible { outline: 2px solid var(--q-primary); outline-offset: 2px; }
.pet-fab.dragging { cursor: grabbing; transition: none; box-shadow: 0 5px 16px rgba(0, 0, 0, .2); }
.pet-fab.dragging .pet-sprite { animation: none; }
.pet-fab.pet-hidden { display: none; }

/* 宠物本体（纯 CSS 团子，不依赖图片资源） */
.pet-sprite {
	position: relative;
	width: 32px;
	height: 32px;
	border-radius: 50% 50% 44% 44%;
	background: radial-gradient(circle at 34% 28%, rgba(255, 255, 255, .55), transparent 55%), #ffb74d;
	box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .07);
	animation: pet-breathe 2.6s ease-in-out infinite;
}
/* 加载角色素材后，隐藏首屏占位形象。 */
.pet-sprite.has-art { background: none; box-shadow: none; }
.pet-sprite.has-art::before, .pet-sprite.has-art::after { display: none; }
.pet-fab .pet-sprite { width: 100%; height: 100%; pointer-events: none; }

.pet-art-star-sprout {
	--pet-poses: url("../img/pet/star-sprout-poses.webp");
	--pet-avatar: url("../img/pet/star-sprout-avatar.webp");
}
.pet-art-cream-cat {
	--pet-poses: url("../img/pet/cream-cat-poses.webp");
	--pet-avatar: url("../img/pet/cream-cat-avatar.webp");
}
.pet-art-honey-dog {
	--pet-poses: url("../img/pet/honey-dog-poses.webp");
	--pet-avatar: url("../img/pet/honey-dog-avatar.webp");
}
.pet-art-herbalist {
	--pet-poses: url("../img/pet/herbalist-poses.webp");
	--pet-avatar: url("../img/pet/herbalist-avatar.webp");
}
.pet-art-snow-horn {
	--pet-poses: url("../img/pet/snow-horn-poses.webp");
	--pet-avatar: url("../img/pet/snow-horn-avatar.webp");
}
.pet-art-basketball {
	--pet-poses: url("../img/pet/basketball-poses.webp");
	--pet-avatar: url("../img/pet/basketball-avatar.webp");
	--pet-atlas-height: 300%;
	--pet-expression-row: 50%;
}
.pet-art-atlas, .pet-art-portrait {
	display: block;
	width: 100%;
	height: 100%;
	pointer-events: none;
	background-repeat: no-repeat;
}
.pet-art-portrait {
	background-image: var(--pet-avatar);
	background-position: center;
	background-size: contain;
	-webkit-mask-image: linear-gradient(#000 0 86%, transparent 100%);
	mask-image: linear-gradient(#000 0 86%, transparent 100%);
}
.pet-art-atlas {
	background-image: var(--pet-poses);
	background-size: 300% var(--pet-atlas-height, 200%);
	background-position: 0 0;
}
.pet-interactive[data-pet-gaze="left"] .pet-art-atlas { background-position: 50% 0; }
.pet-interactive[data-pet-gaze="right"] .pet-art-atlas { background-position: 100% 0; }
.pet-interactive.is-petted .pet-art-atlas,
.pet-sprite.action-happy .pet-art-atlas,
.pet-sprite.action-satisfied .pet-art-atlas { background-position: 0 var(--pet-expression-row, 100%); }
.pet-sprite.action-eating .pet-art-atlas {
	background-position: 50% var(--pet-expression-row, 100%);
	animation: pet-chew-frames .36s steps(1, end) infinite;
}
@keyframes pet-chew-frames {
	0% { background-position: 50% var(--pet-expression-row, 100%); }
	50%, 100% { background-position: 100% var(--pet-expression-row, 100%); }
}

.pet-sprite.action-walk { animation: pet-walk-bob .8s ease-in-out infinite; }
.pet-sprite.action-run { animation: pet-run-bob .42s ease-in-out infinite; }
.pet-sprite.action-eating { animation: pet-eat-bob .5s ease-in-out 4; }
.pet-sprite.action-dribble { animation: pet-eat-bob .55s ease-in-out infinite; }
.pet-sprite.action-shoot { animation: pet-lean .45s ease-out both; }
.pet-sprite.action-dunk { animation: pet-home-petted .55s ease-out; }
.action-dribble .pet-art-atlas.pet-art-basketball { background-position: 0 100%; }
.action-shoot .pet-art-atlas.pet-art-basketball { background-position: 50% 100%; }
.action-dunk .pet-art-atlas.pet-art-basketball { background-position: 100% 100%; }

/* 食物飘字 */
.pet-feed-fx {
	position: fixed;
	font-size: 14px;
	z-index: 1307;
	pointer-events: none;
	animation: pet-feed-up 1s ease-out forwards;
}

.pet-sprite .pet-ear {
	position: absolute;
	top: -3.5px;
	width: 8px;
	height: 8px;
	border-radius: 50% 50% 0 50%;
	background: #ffb74d;
	pointer-events: none;
}
.pet-sprite .pet-ear.left { left: 1px; transform: rotate(-18deg); }
.pet-sprite .pet-ear.right { right: 1px; transform: rotate(18deg) scaleX(-1); }
.pet-sprite::before,
.pet-sprite::after {
	content: '';
	position: absolute;
	top: 7px;
	width: 3px;
	height: 3px;
	border-radius: 50%;
	background: #4a3728;
	animation: pet-blink 4.2s infinite;
}
.pet-sprite::before { left: 5px; }
.pet-sprite::after { right: 5px; }
.pet-sprite .pet-mouth {
	position: absolute;
	left: 50%;
	top: 12px;
	width: 4px;
	height: 2px;
	margin-left: -2px;
	border-bottom: 1.5px solid #4a3728;
	border-radius: 0 0 4px 4px;
}
.pet-sprite .pet-cheek {
	position: absolute;
	top: 11px;
	width: 2.5px;
	height: 2px;
	border-radius: 50%;
	background: rgba(255, 120, 120, .45);
}
.pet-sprite .pet-cheek.left { left: 1.5px; }
.pet-sprite .pet-cheek.right { right: 1.5px; }

/* 状态：饥饿（抖动 + 蔫） */
.pet-sprite.state-1 { animation: pet-breathe 2.6s ease-in-out infinite, pet-hungry 1.6s ease-in-out infinite; }
.pet-sprite.state-1 .pet-mouth { border-bottom: none; border-top: 1.5px solid #8a5a2b; border-radius: 4px 4px 0 0; top: 13px; height: 1.5px; }

/* 状态：濒死（灰化 + 趴下） */
.pet-sprite.state-2 { filter: grayscale(.55); animation: pet-breathe-starving 3.4s ease-in-out infinite; }
.pet-sprite.state-2::before, .pet-sprite.state-2::after { height: 1.5px; top: 8px; }

/* 状态：饿死（墓碑态） */
.pet-sprite.state-3 { filter: grayscale(1); opacity: .6; animation: none; }
.pet-sprite.state-3::before, .pet-sprite.state-3::after {
	height: 1.5px;
	top: 8px;
	width: 3px;
	border-radius: 0;
	transform: rotate(45deg);
}
.pet-sprite.state-3::after { transform: rotate(-45deg); }
.pet-sprite.state-3 .pet-mouth { display: none; }
.pet-sprite.state-3 .pet-cheek { display: none; }

/* 饥饿红点：黄 / 橙 / 红三级 */
.pet-dot {
	position: absolute;
	top: 1px;
	right: 1px;
	min-width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #faad14;
	border: 1.5px solid var(--q-card);
	display: none;
}
.pet-dot.level-2 { background: #fa8c16; animation: pet-dot-blink 1.2s infinite; }
.pet-dot.level-3 { background: #ff4d4f; animation: none; }
.pet-fab.has-dot .pet-dot { display: block; }

/* 气泡 */
/* 具体 left/top 由 JS 按宠物球实时位置计算（右侧放不下时翻到左侧） */
.pet-bubble {
	position: fixed;
	left: 50px;
	top: auto;
	bottom: 70px;
	max-width: 180px;
	padding: 6px 10px;
	background: var(--q-card);
	color: var(--q-text);
	border: 1px solid var(--q-line);
	border-radius: 10px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
	font-size: 12px;
	line-height: 1.5;
	z-index: 1306;
	display: none;
	cursor: pointer;
}
.pet-bubble::before {
	content: '';
	position: absolute;
	left: -5px;
	top: 50%;
	margin-top: -4px;
	width: 8px;
	height: 8px;
	background: var(--q-card);
	border-left: 1px solid var(--q-line);
	border-bottom: 1px solid var(--q-line);
	transform: rotate(45deg);
}
/* 球右侧空间不足时气泡翻到左边，箭头朝右 */
.pet-bubble.left::before {
	left: auto;
	right: -5px;
	border-left: none;
	border-bottom: none;
	border-right: 1px solid var(--q-line);
	border-top: 1px solid var(--q-line);
}
.pet-bubble.show { display: block; animation: pet-pop .22s ease-out; }

/* 闲聊气泡：卡通浅黄，点击即消失（与饥饿提醒的卡片底区分开） */
.pet-bubble.chat {
	background: #fffbe6;
	border-color: #ffe58f;
	color: #614700;
	max-width: 200px;
}
.pet-bubble.chat::before { background: #fffbe6; border-color: #ffe58f; }
[data-theme="dark"] .pet-bubble.chat { background: #2b2a1e; border-color: #5c4b1a; color: #ffe58f; }
[data-theme="dark"] .pet-bubble.chat::before { background: #2b2a1e; border-color: #5c4b1a; }

/* 漂浮粮食 */
.pet-food {
	position: fixed;
	width: 38px;
	height: 38px;
	margin: -19px 0 0 -19px;
	border-radius: 50%;
	background: var(--q-card);
	border: 1px solid var(--q-line);
	box-shadow: 0 2px 10px rgba(0, 0, 0, .16);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 17px;
	color: #fa8c16;
	z-index: 1306;
	cursor: pointer;
	animation: pet-food-float 1.8s ease-in-out infinite, pet-pop .25s ease-out;
	-webkit-tap-highlight-color: transparent;
}
.pet-food::after {
	content: '';
	position: absolute;
	inset: -5px;
	border-radius: 50%;
	border: 2px solid rgba(250, 140, 22, .32);
	animation: pet-ring 1.4s ease-out infinite;
}
/* 多份合并粮袋：按份数放大并闪光（size-2 轻微，size-3/4 明显） */
.pet-food.size-2 {
	width: 46px; height: 46px; margin: -23px 0 0 -23px; font-size: 20px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .16), 0 0 8px 2px rgba(250, 140, 22, .25);
	animation: pet-food-float 1.8s ease-in-out infinite, pet-pop .25s ease-out, pet-glow 1.8s ease-in-out infinite;
}
.pet-food.size-3 {
	width: 54px; height: 54px; margin: -27px 0 0 -27px; font-size: 23px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .16), 0 0 0 1px rgba(255, 214, 102, .85), 0 0 14px 4px rgba(250, 140, 22, .4);
	animation: pet-food-float 1.8s ease-in-out infinite, pet-pop .25s ease-out, pet-glow 1.5s ease-in-out infinite;
}
.pet-food.size-4 {
	width: 64px; height: 64px; margin: -32px 0 0 -32px; font-size: 26px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .16), 0 0 0 1px rgba(255, 214, 102, .95), 0 0 18px 6px rgba(250, 140, 22, .5);
	animation: pet-food-float 1.8s ease-in-out infinite, pet-pop .25s ease-out, pet-glow 1.2s ease-in-out infinite;
}
.pet-food.size-2::before,
.pet-food.size-3::before,
.pet-food.size-4::before {
	content: '✦';
	position: absolute;
	top: -5px;
	right: -5px;
	color: #ffd666;
	font-size: 12px;
	line-height: 1;
	text-shadow: 0 0 6px #fa8c16;
	pointer-events: none;
	animation: pet-sparkle 1.4s ease-in-out infinite;
}
.pet-food.size-4::before {
	top: -8px;
	right: -8px;
	font-size: 16px;
	animation-delay: -.5s;
}
.pet-food-count {
	position: absolute;
	right: -7px;
	bottom: -7px;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	border-radius: 9px;
	background: #fa8c16;
	color: #fff;
	font-size: 11px;
	line-height: 18px;
	text-align: center;
	pointer-events: none;
}
.pet-food.picked { animation: pet-food-pick .35s ease-out forwards; pointer-events: none; }

/* +1 飘字 */
.pet-gain {
	position: fixed;
	color: #52c41a;
	font-size: 13px;
	font-weight: bold;
	z-index: 1307;
	pointer-events: none;
	animation: pet-gain-up .9s ease-out forwards;
}

/* 喂食面板 */
.pet-panel { padding: 12px 12px 16px; color: var(--q-text); }
.pet-panel .pet-panel-head { display: flex; align-items: center; gap: 12px; }
.pet-panel .pet-avatar {
	width: var(--pet-panel-size);
	height: var(--pet-panel-size);
	max-width: 42%;
	border-radius: 50%;
	background: var(--q-bg);
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
}
.pet-panel .pet-avatar .pet-sprite { display: block; width: 92%; height: 92%; }
.pet-touch {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	border: 0;
	border-radius: inherit;
	background: transparent;
	padding: 0;
	cursor: pointer;
	touch-action: manipulation;
}
.pet-touch:focus-visible { outline: 2px solid var(--q-primary, #3b70c6); outline-offset: 2px; }
.pet-home { max-width: 680px; padding: 12px; }
.pet-home .pet-home-card { text-align: center; padding: 16px; }
[data-theme="cartoon"] .pet-home .pet-home-card:active { transform: none; }
.pet-home-title { margin: 0 0 12px; font-size: 18px; font-weight: 700; }
.pet-home-level { margin-left: 5px; color: var(--q-primary); font-size: 13px; }
.pet-room-scene {
	position: relative;
	overflow: hidden;
	isolation: isolate;
	border: 1px solid #d9aa7c;
	border-radius: 24px;
	background: linear-gradient(#ffebcc 0%, #f8d4a6 66%, #d59664 66%, #e9b182 100%);
}
.pet-room-window {
	position: absolute;
	left: 10%;
	top: 12%;
	width: 21%;
	height: 42%;
	border: 5px solid #a96f48;
	border-radius: 48% 48% 9px 9px;
	background: linear-gradient(90deg, transparent 47%, #a96f48 47% 53%, transparent 53%),
		linear-gradient(transparent 52%, #a96f48 52% 59%, transparent 59%), linear-gradient(#bae0e2, #fff5ce);
	box-shadow: 5px 6px 0 #a86b442f;
}
.pet-room-rug {
	position: absolute;
	inset: auto 11% 7%;
	height: 23%;
	border-radius: 50%;
	background: #f4cb9b;
	box-shadow: inset 0 0 0 3px #f7dcba, 0 3px 0 #ae764950;
}
[data-theme="dark"] .pet-room-scene { background: linear-gradient(#654954 0 66%, #50363f 66%); border-color: #725359; }
[data-theme="dark"] .pet-room-window { filter: brightness(.65); }
[data-theme="dark"] .pet-room-rug { background: #a27578; box-shadow: inset 0 0 0 3px #bb9194; }
.pet-room-scene[data-background="garden"] { background: linear-gradient(#caece6 0 64%, #8dbb83 64%); }
.pet-room-scene[data-background="night"] { background: linear-gradient(#414566 0 66%, #695269 66%); }
.pet-room-scene[data-background="garden"] .pet-room-window { background: radial-gradient(circle at 65% 30%, #fff2a9 0 16%, #b8e4ed 17%); }
.pet-room-scene[data-background="night"] .pet-room-window {
	background: radial-gradient(circle at 67% 29%, #fff5ad 0 14%, transparent 15%),
		radial-gradient(circle at 32% 62%, #f9eac6 0 4%, #293557 5%);
}
.pet-room-scene[data-background="night"] .pet-room-rug { background: #8878a1; box-shadow: inset 0 0 0 3px #ad96ba; }
.pet-room-scene[data-background="garden"] .pet-room-rug { background: #e8d693; box-shadow: inset 0 0 0 3px #fff0af; }
.pet-room-scene[data-decoration="scarf"] .pet-home-stage .pet-sprite::after {
	display: block;
	position: absolute;
	content: "";
	left: 35%;
	top: 46%;
	width: 30%;
	height: 8%;
	border-radius: 3px 3px 60% 60%;
	background: #bd584b;
	box-shadow: inset 0 -2px 0 #9c4039;
	pointer-events: none;
}
.pet-room-scene[data-decoration="badge"] .pet-home-stage .pet-sprite::after,
.pet-room-scene[data-decoration="star"] .pet-home-stage .pet-sprite::after {
	display: grid;
	place-items: center;
	position: absolute;
	content: "✦";
	top: 53%;
	left: 55%;
	width: 12%;
	height: 12%;
	border-radius: 50%;
	background: #ffe4a0;
	color: #9b5b10;
	font-size: clamp(12px, 3vw, 21px);
	line-height: 1;
	pointer-events: none;
}
.pet-room-scene[data-decoration="badge"] .pet-home-stage .pet-sprite::after { content: "◆"; background: #e7c7ea; color: #754e8b; }
.pet-room-scene[data-decoration="scarf"] .pet-home-stage .skin-CAT::after {
	top: 48%;
	left: 43%;
	width: 26%;
	height: 7%;
}
.pet-room-scene[data-decoration="scarf"] .pet-home-stage .skin-DUMPLING::after {
	top: 56%;
	left: 20%;
	width: 43%;
	height: 6%;
}
.pet-room-scene[data-decoration="scarf"] .pet-home-stage .skin-GIRL::after,
.pet-room-scene[data-decoration="scarf"] .pet-home-stage .skin-DEMON::after,
.pet-room-scene[data-decoration="scarf"] .pet-home-stage .skin-BASKET::after {
	top: 44%;
	left: 43%;
	width: 17%;
	height: 5%;
}
.pet-room-scene[data-decoration="star"] .pet-home-stage .skin-CAT::after,
.pet-room-scene[data-decoration="badge"] .pet-home-stage .skin-CAT::after { left: 62%; top: 59%; }
.pet-room-scene[data-decoration="star"] .pet-home-stage .skin-DUMPLING::after,
.pet-room-scene[data-decoration="badge"] .pet-home-stage .skin-DUMPLING::after { top: 70%; }
.pet-home-stage {
	position: relative;
	width: var(--pet-home-size);
	max-width: 100%;
	aspect-ratio: 1;
	margin: 0 auto;
	border-radius: 28px;
}
.pet-home-stage .pet-sprite { display: block; width: 94%; height: 94%; }
.pet-home-interaction {
	display: grid;
	place-items: center;
	min-height: 28px;
	font-size: 13px;
	color: var(--q-muted);
}
.pet-home-interaction > span { grid-area: 1 / 1; }
.pet-home-interaction .pet-interaction-message:not(:empty) + #petHomeInstruction { visibility: hidden; }
.pet-home-interaction .pet-interaction-message:not(:empty) { color: var(--q-primary); font-weight: 600; }
.pet-home-summary { margin-top: 10px; }
#petDemoFeed { margin-bottom: 8px; }
#petDemoFeed[aria-disabled="true"] { opacity: .66; cursor: progress; }
.pet-home-feed { margin: 0 0 13px; }
.pet-home-secondary { margin-top: 12px; }
.pet-home-secondary summary { color: var(--q-primary); cursor: pointer; }
.pet-home-meter { height: 8px; border-radius: 4px; background: var(--q-line); overflow: hidden; max-width: 220px; margin: 10px auto; }
.pet-home-meter > div { height: 100%; background: #52c41a; }
.pet-home-warning { color: #b86714; }
.pet-home-warning:empty, .pet-growth p:empty, .pet-growth-unlocked:empty { display: none; }
.pet-growth { padding: 9px; border-radius: 14px; background: var(--q-bg); }
.pet-growth strong { margin-right: 6px; color: var(--q-primary); }
.pet-growth p { margin: 5px 0 0; }
.pet-growth-unlocked { list-style: none; display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 0; margin: 6px 0 0; }
.pet-growth-unlocked li { border: 1px solid var(--q-line); border-radius: 14px; padding: 2px 7px; font-size: 12px; }
.pet-home-warning-dead { color: #df494e; }
.pet-home-actions { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pet-size-control { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.pet-size-control select { width: auto; min-width: 58px; }
.pet-fab-size-control input[type="range"] { width: 140px; accent-color: var(--q-primary); cursor: pointer; }
.pet-fab-size-control output { min-width: 44px; font-size: 12px; color: var(--q-muted); }
.pet-display-settings p { margin: 10px 0 0; }
.pet-display-settings .pet-interaction-message:empty { display: none; }
.pet-room-editor p { margin: 8px 0; }
.pet-room-editor p:empty { display: none; }
.pet-room-editor [hidden] { display: none !important; }
.pet-room-history { list-style: none; text-align: left; padding: 0; margin: 8px 0 0; }
.pet-room-history li { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--q-line); }
.pet-room-history time { flex: none; color: var(--q-muted); font-size: 12px; }
.pet-interaction-message { color: var(--q-muted); font-size: 13px; min-height: 18px; }
.pet-panel .pet-interaction-message:not(:empty) { margin-top: 5px; }
.pet-panel .pet-interaction-message:empty { min-height: 0; }
.pet-interactive.is-petted .pet-sprite { animation: pet-petted .45s ease-out; }
.pet-home-stage.is-petted .pet-sprite { animation-name: pet-home-petted; }
.pet-interactive.is-petted .pet-sprite.has-petting { animation: pet-unlocked-petting .68s ease-out; }
@keyframes pet-unlocked-petting {
	0%, 100% { transform: none; }
	28% { transform: translateY(-8px) rotate(-8deg); }
	65% { transform: translateY(-5px) rotate(8deg); }
}
.pet-interactive.is-drop-over .pet-sprite, .pet-interactive .action-anticipating { animation: pet-lean .45s ease-out both; }
.pet-interactive .action-satisfied { animation: pet-home-petted .55s ease-out; }
@keyframes pet-lean {
	to { transform: translateY(-4px) scale(1.06); }
}
.pet-interactive.is-drop-ready { box-shadow: 0 0 0 2px #f0a43b; }
.pet-interactive.is-drop-over { background: #ffe9bf; box-shadow: 0 0 0 3px #e59422; }
.pet-drag-hint { color: var(--q-muted); font-size: 12px; margin: 0 0 6px; }
.pet-panel .pet-bag-item .pet-drag-food {
	display: grid;
	place-items: center;
	width: 36px;
	min-height: 36px;
	flex: none;
	cursor: grab;
	touch-action: none;
	user-select: none;
}
.pet-panel .pet-drag-food.is-dragging { opacity: .35; }
.pet-food-ghost {
	display: grid;
	place-items: center;
	position: fixed;
	top: 0;
	left: 0;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: #fff1d7;
	color: #b75608;
	pointer-events: none;
	z-index: 2147483000;
}
.pet-panel.is-meal-pending .pet-feed,
.pet-panel.is-meal-pending .pet-revive,
.pet-panel.is-meal-pending .pet-drag-food { opacity: .55; cursor: progress; }
.pet-answer-reaction {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 5px;
	color: var(--q-muted);
	font-size: 13px;
}
.pet-answer-reaction .pet-answer-cheer { animation: pet-petted .52s ease-out; }
.pet-answer-reaction .pet-answer-nod { animation: pet-answer-nod .48s ease-in-out; }
.pet-answer-milestone { padding: 4px 10px; border-radius: 18px; background: var(--q-bg); color: var(--q-primary); }
.pet-answer-milestone .pet-answer-cheer { animation-duration: .82s; }
.pet-answer-stars::after { content: "✦ ✦"; color: #ac670e; }
@keyframes pet-petted {
	0%, 100% { transform: translateY(0) scale(1); }
	42% { transform: translateY(-5px) scale(1.06, .96); }
}
@keyframes pet-home-petted {
	0%, 100% { transform: translateY(0) scale(1); }
	42% { transform: translateY(-10px) scale(1.08, .94); }
}
@keyframes pet-answer-nod {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(3px) scaleY(.94); }
}
@media (prefers-reduced-motion: reduce) {
	.pet-sprite, .pet-sprite *, .pet-dot, .pet-bubble, .pet-food, .pet-food *,
	.pet-gain, .pet-feed-fx, .pet-feed-fx * { animation: none !important; }
	.pet-fab { transition: none; }
	.pet-interactive[data-pet-gaze] .pet-sprite.action-idle .pet-art-atlas {
		background-position: 0 0;
	}
	.pet-interactive.is-petted[data-pet-gaze] .pet-sprite .pet-art-atlas {
		background-position: 0 var(--pet-expression-row, 100%);
	}
}
.pet-panel .pet-info { flex: 1; min-width: 0; }
.pet-panel .pet-name { font-size: 15px; font-weight: bold; display: flex; align-items: center; gap: 6px; }
.pet-panel .pet-name .pet-lv { color: var(--q-primary); font-size: 12px; font-weight: normal; }
.pet-panel .pet-name a { font-size: 11px; color: var(--q-muted); font-weight: normal; }
.pet-panel .pet-meta { font-size: 12px; color: var(--q-muted); margin-top: 4px; }
.pet-panel .pet-bar { height: 7px; border-radius: 4px; background: var(--q-line); overflow: hidden; margin-top: 5px; }
.pet-panel .pet-bar i { display: block; height: 100%; border-radius: 4px; background: #52c41a; transition: width .3s; }
.pet-panel .pet-bar.warn i { background: #faad14; }
.pet-panel .pet-bar.danger i { background: #ff4d4f; }
.pet-panel .pet-warn {
	margin-top: 10px;
	padding: 8px 10px;
	border-radius: 8px;
	font-size: 12px;
	line-height: 1.6;
	background: rgba(250, 173, 20, .12);
	color: #ad6800;
}
.pet-panel .pet-warn.dead { background: rgba(255, 77, 79, .12); color: #a8071a; }
.pet-panel .pet-section { font-size: 12px; color: var(--q-muted); margin: 14px 0 8px; }
.pet-panel .pet-bag { display: flex; flex-direction: column; gap: 8px; }
.pet-panel .pet-bag-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	border: 1px solid var(--q-line);
	border-radius: 10px;
	background: var(--q-bg);
}
.pet-panel .pet-bag-item .icon { width: 26px; text-align: center; font-size: 18px; color: #fa8c16; }
.pet-panel .pet-bag-item .name { flex: 1; min-width: 0; font-size: 13px; }
.pet-panel .pet-bag-item .name small { display: block; color: var(--q-muted); font-size: 11px; margin-top: 2px; }
.pet-panel .pet-bag-item .btn { padding: 2px 8px; font-size: 12px; }
.pet-panel .pet-empty { font-size: 12px; color: var(--q-muted); padding: 10px 0; text-align: center; }
.pet-panel .pet-actions { margin-top: 14px; display: flex; gap: 8px; }
.pet-panel .pet-actions .btn { flex: 1; }
.pet-panel .pet-recent { margin-top: 12px; font-size: 11px; color: var(--q-muted); line-height: 1.9; }
.pet-panel .pet-recent b { color: var(--q-text); font-weight: normal; }

/* 宠物市场 / 购买粮食 / 我的订单 */
.pet-market-top { font-size: 12px; color: var(--q-muted); margin-bottom: 10px; }
.pet-market-top b { color: var(--q-primary); }
.pet-market-list { display: flex; flex-direction: column; gap: 8px; }
.pet-market-item { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--q-line); border-radius: 10px; background: var(--q-bg); }
.pet-market-avatar { width: 46px; height: 46px; flex: none; display: flex; align-items: center; justify-content: center; }
.pet-market-info { flex: 1; min-width: 0; }
.pet-market-info .name { font-size: 13px; font-weight: bold; }
.pet-market-info .desc { font-size: 11px; color: var(--q-muted); margin-top: 2px; line-height: 1.5; }
.pet-market-info .price { font-size: 11px; color: #fa8c16; margin-top: 3px; }
.pet-market-op { flex: none; }
.pet-market-disabled { font-size: 11px; color: var(--q-muted); }
.pet-market-tip { margin-top: 12px; font-size: 11px; color: var(--q-muted); line-height: 1.6; }
.pet-pkg-list { display: flex; flex-direction: column; gap: 8px; }
.pet-pkg-item { display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--q-line); border-radius: 10px; background: var(--q-bg); font-size: 12px; margin: 0; font-weight: normal; cursor: pointer; }
.pet-pkg-item input { margin: 0; }
.pet-pkg-item .name { flex: 1; min-width: 0; }
.pet-pkg-item .amount { color: var(--q-muted); }
.pet-pkg-item .price { color: #fa8c16; }
.pet-order-item { padding: 10px; border-bottom: 1px dashed var(--q-line); }
.pet-order-item .name { font-size: 13px; font-weight: bold; }
.pet-order-item .meta { font-size: 11px; color: var(--q-muted); margin-top: 3px; line-height: 1.5; }
.pet-order-item .meta b { color: var(--q-text); font-weight: normal; }

@keyframes pet-walk-bob {
	0% { transform: translate(0, 0); }
	25% { transform: translate(1px, -1.5px); }
	50% { transform: translate(0, 0); }
	75% { transform: translate(-1px, -1.5px); }
	100% { transform: translate(0, 0); }
}
@keyframes pet-run-bob {
	0% { transform: translate(0, 0); }
	25% { transform: translate(2px, -2.5px); }
	50% { transform: translate(0, 0); }
	75% { transform: translate(-2px, -2.5px); }
	100% { transform: translate(0, 0); }
}


@keyframes pet-eat-bob {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(1.5px) scaleY(.97); }
}
@keyframes pet-feed-up {
	0% { opacity: 0; transform: translateY(4px) scale(.7); }
	30% { opacity: 1; }
	100% { opacity: 0; transform: translateY(-26px) scale(1.1); }
}

@keyframes pet-breathe {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.035); }
}
@keyframes pet-blink {
	0%, 92%, 100% { transform: scaleY(1); }
	95% { transform: scaleY(.1); }
}
@keyframes pet-breathe-starving {
	0%, 100% { transform: scale(1, .86); }
	50% { transform: scale(1.03, .89); }
}
@keyframes pet-hungry {
	0%, 100% { transform: translateY(0) rotate(0); }
	25% { transform: translateY(1px) rotate(-2deg); }
	75% { transform: translateY(1px) rotate(2deg); }
}
@keyframes pet-dot-blink {
	0%, 100% { opacity: 1; }
	50% { opacity: .35; }
}
@keyframes pet-pop {
	0% { transform: scale(.6); opacity: 0; }
	100% { transform: scale(1); opacity: 1; }
}
@keyframes pet-food-float {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-6px); }
}
@keyframes pet-ring {
	0% { transform: scale(.8); opacity: .8; }
	100% { transform: scale(1.25); opacity: 0; }
}
@keyframes pet-food-pick {
	0% { transform: scale(1); opacity: 1; }
	100% { transform: scale(.2) translateY(-40px); opacity: 0; }
}
@keyframes pet-gain-up {
	0% { transform: translateY(0); opacity: 1; }
	100% { transform: translateY(-34px); opacity: 0; }
}
@keyframes pet-glow {
	0%, 100% { filter: brightness(1); }
	50% { filter: brightness(1.18); }
}
@keyframes pet-sparkle {
	0%, 100% { transform: scale(.5) rotate(0); opacity: .25; }
	50% { transform: scale(1.25) rotate(25deg); opacity: 1; }
}

/* 底部导航红点（我的 Tab） */
.pet-nav-dot {
	display: none;
	position: absolute;
	top: 4px;
	right: 50%;
	margin-right: -18px;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #ff4d4f;
}
.bottom-nav a { position: relative; }
.bottom-nav a.has-pet-dot .pet-nav-dot { display: block; }

/* 深色主题下宠物面板与气泡的边界更清晰 */
[data-theme="dark"] .pet-fab,
[data-theme="dark"] .pet-bubble,
[data-theme="dark"] .pet-food { border-color: #3a3a44; }
[data-theme="dark"] .pet-panel .pet-warn { color: #ffd666; }
[data-theme="dark"] .pet-panel .pet-warn.dead { color: #ffa39e; }

/* ==========================================================
   动漫风皮肤：弹层 / 提示
   ========================================================== */
.layui-layer.pet-layer {
	border-radius: 20px !important;
	overflow: hidden;
	border: 2px solid #ffd6e7;
	box-shadow: 0 14px 36px rgba(255, 130, 170, .28);
	background: #fffafd;
}
.layui-layer.pet-layer .layui-layer-title {
	height: 44px;
	line-height: 44px;
	background: linear-gradient(135deg, #ffd6e7 0%, #e7d9ff 100%);
	color: #7a4568;
	font-weight: 700;
	font-size: 15px;
	letter-spacing: .5px;
	border-bottom: 2px solid #ffe3ef;
}
.layui-layer.pet-layer .layui-layer-content {
	background: linear-gradient(180deg, #fffafd, #fff6fb);
}
/* 标题栏关闭按钮：独立版 layer 无 layui-icon 字体，改用 FontAwesome 画 ×，圆形贴标题栏配色 */
.layui-layer.pet-layer .layui-layer-setwin {
	top: 9px;
	right: 10px;
}
.layui-layer.pet-layer .layui-layer-setwin .layui-layer-close1 {
	width: 26px;
	height: 26px;
	line-height: 26px;
	font-size: 14px;
	color: #7a4568;
	background: rgba(255, 255, 255, .6);
	border-radius: 50%;
	text-align: center;
}
.layui-layer.pet-layer .layui-layer-setwin .layui-layer-close1::before {
	font-family: "FontAwesome";
	font-style: normal;
	font-weight: normal;
	content: "\f00d";
}
html[data-theme="dark"] .layui-layer.pet-layer .layui-layer-setwin .layui-layer-close1 {
	color: #ffd6e7;
	background: rgba(0, 0, 0, .28);
}

.layui-layer.pet-layer-msg {
	background: #fffafd !important;
	border: 2px solid #ffd0e2 !important;
	border-radius: 999px !important;
	box-shadow: 0 8px 22px rgba(255, 140, 180, .28) !important;
	min-width: 120px;
}
.layui-layer.pet-layer-msg .layui-layer-content {
	color: #8a4a6b;
	font-weight: 600;
	padding: 9px 18px;
	text-align: center;
}
.pet-toast-icon { margin-right: 6px; }

html[data-theme="dark"] .layui-layer.pet-layer {
	background: #2a2430;
	border-color: #4a3b52;
	box-shadow: 0 14px 36px rgba(0, 0, 0, .45);
}
html[data-theme="dark"] .layui-layer.pet-layer .layui-layer-title {
	background: linear-gradient(135deg, #4a2f42, #3b3358);
	color: #ffd6e7;
	border-bottom-color: #51394b;
}
html[data-theme="dark"] .layui-layer.pet-layer .layui-layer-content {
	background: #2a2430;
}
html[data-theme="dark"] .layui-layer.pet-layer-msg {
	background: #332a38 !important;
	border-color: #5a4050 !important;
}
html[data-theme="dark"] .layui-layer.pet-layer-msg .layui-layer-content {
	color: #ffd6e7;
}

/* 按钮：胶囊、粉紫渐变、有厚度的阴影 */
.pet-panel .btn {
	border-radius: 999px;
	border-width: 2px;
	font-weight: 600;
	padding: 4px 12px;
	transition: transform .12s, box-shadow .12s;
}
.pet-panel .btn-primary {
	background: linear-gradient(135deg, #ff9ec4, #b39ddb);
	border-color: #ffb7d5;
	color: #fff;
	box-shadow: 0 3px 0 #e58bb0;
}
.pet-panel .btn-default {
	background: #fff;
	border-color: #ffc9de;
	color: #a34d78;
	box-shadow: 0 2px 0 #ffe0ec;
}
.pet-panel .btn-warning {
	background: linear-gradient(135deg, #ffd166, #ff9f68);
	border-color: #ffd9a0;
	color: #7a4a12;
	box-shadow: 0 3px 0 #e8a34f;
}
.pet-panel .btn-danger {
	background: linear-gradient(135deg, #ff8fa3, #ff6b8b);
	border-color: #ffb3c4;
	color: #fff;
	box-shadow: 0 3px 0 #e05672;
}
.pet-panel .btn:active {
	transform: translateY(2px);
	box-shadow: none;
}
.pet-panel .btn[disabled] {
	opacity: .5;
}

/* 进度条 / 粮袋 / 市场卡片 */
.pet-panel .pet-bar { height: 8px; }
.pet-panel .pet-bar i { background: linear-gradient(90deg, #ff9ec4, #b39ddb); }
.pet-panel .pet-bar.warn i { background: linear-gradient(90deg, #ffd166, #ff9f68); }
.pet-panel .pet-bar.danger i { background: linear-gradient(90deg, #ff8fa3, #ff6b8b); }
.pet-panel .pet-bag-item {
	border: 2px dashed #ffd6e7;
	background: #fff9fc;
	border-radius: 14px;
}
.pet-panel .pet-market-item {
	border: 2px solid #ffe3ef;
	background: #fff9fc;
	border-radius: 16px;
	box-shadow: 0 3px 10px rgba(255, 160, 190, .12);
}
.pet-panel .pet-pkg-item {
	border: 2px solid #ffe3ef;
	background: #fff9fc;
	border-radius: 14px;
}
html[data-theme="dark"] .pet-panel .pet-bag-item,
html[data-theme="dark"] .pet-panel .pet-market-item,
html[data-theme="dark"] .pet-panel .pet-pkg-item {
	border-color: #51394b;
	background: #332a38;
}
html[data-theme="dark"] .pet-panel .btn-default {
	background: #332a38;
	border-color: #5a4050;
	color: #ffd6e7;
	box-shadow: 0 2px 0 #241e28;
}
