/* PIXEL_TOWN_BEGIN */
/* ===== 0. 变量 ===== */
:root{
  --pt-wood:#8a5a32; --pt-wood-dark:#4a3324; --pt-cream:#fff1d6; --pt-gold:#f2c566;
  --pt-ring:0 0 0 2px #fff4dc,0 0 0 4px #4a3324,0 3px 0 4px rgba(58,42,31,.28);
  --pt-ring-sm:0 0 0 1.5px #fff4dc,0 0 0 3px #4a3324;
  --pt-shadow:drop-shadow(0 2px 0 rgba(40,25,15,.38));
}

/* ===== 1. 场景：位图背景替换旧矢量世界 ===== */
html body .app .scene{
  container-type:inline-size;
  background:#cfe0c8 url(/art/town.webp) center bottom / cover no-repeat;
  image-rendering:pixelated;
  border-radius:10px;
  box-shadow:0 0 0 3px var(--pt-wood-dark),0 0 0 7px #e9cf9c,0 0 0 10px var(--pt-wood-dark),0 18px 30px -16px rgba(40,25,15,.6);
}
:root[data-tod="night"] body .app .scene{background-image:url(/art/town-night.webp)}
html body .app .scene > svg.l-sky,
html body .app .scene > svg.l-clouds,
html body .app .scene > svg.l-land,
html body .app .scene > svg.l-fx,
html body .app .scene > svg.l-front{display:none!important}
/* 纸纹改为黄昏/清晨的轻微色调，只盖背景 */
html body .app .scene::after{
  background:var(--tint,#000);opacity:var(--tint-op,0);mix-blend-mode:normal;
  box-shadow:none;z-index:4;border-radius:inherit;
}
:root[data-tod="night"] body .app .scene::after{opacity:0}

/* ===== 2. 自己的小动物（#fox） ===== */
html body #fox > .fox-art{
  background:url(/art/fox.png) center bottom / contain no-repeat;
  image-rendering:pixelated;
  filter:brightness(calc(.4 + var(--night-dim,1) * .6)) var(--pt-shadow);
}
html body #fox > .fox-art[data-ls="cat"]{background-image:url(/art/cat.png)}
html body #fox > .fox-art[data-ls="rabbit"]{background-image:url(/art/rabbit.png)}
html body #fox > .fox-art[data-ls="dog"]{background-image:url(/art/dog.png)}
html body #fox > .fox-art > *{visibility:hidden}
html body #fox > .fox-art *{animation:none!important}
/* 走路：整只小跳，独立 translate，不影响 scaleX(var(--facing)) */
html body #fox.walking > .fox-art{animation:ptHop .44s steps(4,end) infinite}
@keyframes ptHop{0%,100%{translate:0 0}50%{translate:0 -7%}}

/* ===== 3. 访客（SVG 外框换背景，默认镜像朝左） ===== */
html body .pc-layer .pc-guest-hit{
  left:auto!important;right:calc(1cqw + max(44px,9cqw) + 8px)!important;bottom:26%!important;
  width:max(44px,10cqw)!important;height:auto!important;aspect-ratio:1/1;
}
html body .pc-layer .pc-guest-hit .pc-guest-art{
  left:50%;bottom:0;width:100%!important;height:100%!important;
  transform:translateX(-50%) scaleX(-1);
  background:url(/art/fox.png) center bottom / contain no-repeat;
  image-rendering:pixelated;filter:var(--pt-shadow);transition:translate .2s steps(2,end);
}
html body .pc-layer .pc-guest-hit:hover .pc-guest-art{transform:translateX(-50%) scaleX(-1);translate:0 -3px}
html body .pc-layer .pc-guest-hit .pc-guest-art[data-ls="cat"]{background-image:url(/art/cat.png)}
html body .pc-layer .pc-guest-hit .pc-guest-art[data-ls="rabbit"]{background-image:url(/art/rabbit.png)}
html body .pc-layer .pc-guest-hit .pc-guest-art[data-ls="dog"]{background-image:url(/art/dog.png)}
html body .pc-layer .pc-guest-hit .pc-guest-art > *{visibility:hidden;animation:none!important}
html body .pc-layer .pc-knoll{display:none!important}

/* ===== 4. 公园居民阿栗（原按钮 ::after 画像，可点击） ===== */
html body .pc-layer .pc-cat-hit{
  left:auto!important;right:1cqw!important;bottom:25%!important;
  width:max(44px,9cqw)!important;height:auto!important;aspect-ratio:1/1;
}
html body .pc-layer .pc-cat-hit::after{
  content:"";position:absolute;inset:0;pointer-events:none;
  background:url(/art/cat.png) center bottom / contain no-repeat;
  image-rendering:pixelated;transform:scaleX(-1);filter:var(--pt-shadow);
}

/* ===== 5. 名牌：贴在各自头顶，宽度等于触控区，避免互相遮挡 ===== */
html body .scene .tags .tag.cat-tag,
html body .scene .pc-layer .tag.pc-gtag{
  transform:none!important;left:auto!important;top:auto!important;
  box-sizing:border-box;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  padding:1px 4px;border-radius:2px;font:600 10px/1.4 var(--sans);letter-spacing:.02em;
  background:var(--pt-cream);color:var(--pt-wood-dark);
  box-shadow:0 0 0 1.5px var(--pt-wood-dark),0 2px 0 1.5px rgba(40,25,15,.25);
}
html body .scene .tags .tag.cat-tag{
  right:1cqw!important;bottom:calc(25% + max(44px,9cqw) + 3px)!important;
  width:max(44px,9cqw);max-width:max(44px,9cqw);
}
html body .scene .pc-layer .tag.pc-gtag{
  right:calc(1cqw + max(44px,9cqw) + 8px)!important;bottom:calc(26% + max(44px,10cqw) + 3px)!important;
  width:max(44px,10cqw);max-width:max(44px,10cqw);background:#eef1f6;color:#3a4252;
}
html body .scene .tags .tag.cat-tag::before,
html body .scene .pc-layer .tag.pc-gtag::before{display:none}

/* ===== 6. 地点木牌（小巧复古） ===== */
html body .scene .tags .tag.cabin,
html body .scene .tags .tag.park{
  bottom:56%!important;padding:2px 7px;border-radius:2px;
  font:700 clamp(9.5px,1cqw + 5px,12.5px)/1.3 var(--sans);letter-spacing:.12em;
  background:var(--pt-wood);color:var(--pt-cream);
  box-shadow:0 0 0 2px var(--pt-wood-dark),inset 0 -2px 0 rgba(0,0,0,.18),0 3px 0 2px rgba(40,25,15,.25);
}
html body .scene .tags .tag.cabin{left:14%;transform:translateX(-50%)}
html body .scene .tags .tag.park{left:84%;transform:translateX(-50%)}
html body .scene .tags .tag.cabin::before,
html body .scene .tags .tag.park::before{width:3px;height:8px;background:var(--pt-wood-dark)}
html body .scene .tags .tag.cabin.active,
html body .scene .tags .tag.park.active{background:#c8682d;color:#fff8ee}

/* ===== 7. 像素头像：名片、选择器、聊天 ===== */
html body .pc-root .pc-avatar,
html body .pc-root .pc-card[data-kind="self"] .pc-avatar{
  border:0;padding:0;border-radius:6px;box-shadow:var(--pt-ring);background-color:#fff4dc;
}
html body .pc-root .pc-avatar[data-ls]{background:#fff4dc url(/art/fox-face.png) center / cover no-repeat;image-rendering:pixelated}
html body .pc-root .pc-avatar[data-ls="cat"]{background-image:url(/art/cat-face.png)}
html body .pc-root .pc-avatar[data-ls="rabbit"]{background-image:url(/art/rabbit-face.png)}
html body .pc-root .pc-avatar[data-ls="dog"]{background-image:url(/art/dog-face.png)}
html body .pc-root .pc-avatar[data-ls] > *{visibility:hidden}

html body .ls-pick button[data-code] svg{
  border-radius:4px;box-shadow:var(--pt-ring-sm);image-rendering:pixelated;
  background:#fff4dc url(/art/fox-face.png) center / cover no-repeat;
}
html body .ls-pick button[data-code="cat"] svg{background-image:url(/art/cat-face.png)}
html body .ls-pick button[data-code="rabbit"] svg{background-image:url(/art/rabbit-face.png)}
html body .ls-pick button[data-code="dog"] svg{background-image:url(/art/dog-face.png)}
html body .ls-pick button[data-code] svg > *{visibility:hidden}

html body .message.assistant::before{
  background:#fff4dc url(/art/fox-face.png) center / cover no-repeat!important;
  image-rendering:pixelated;border-radius:5px;box-shadow:var(--pt-ring-sm);
}
html[data-ls-pet="cat"] body .message.assistant::before{background-image:url(/art/cat-face.png)!important}
html[data-ls-pet="rabbit"] body .message.assistant::before{background-image:url(/art/rabbit-face.png)!important}
html[data-ls-pet="dog"] body .message.assistant::before{background-image:url(/art/dog-face.png)!important}

/* ===== 8. 减少动态 ===== */
@media (prefers-reduced-motion:reduce){
  html body #fox.walking > .fox-art{animation:none!important;translate:none}
  html body .pc-layer .pc-guest-hit .pc-guest-art{transition:none}
  html body .pc-layer .pc-guest-hit:hover .pc-guest-art{translate:none}
}
/* PIXEL_TOWN_END */
/* TOWN_PARK_FIX */
/* 名片层整体高于 .route，只有按钮和名牌接收点击；按钮底边抬到 30%，高于自己身子的中心（约 27%），x86% 时不会盖住自己 */
html body .scene .pc-layer{z-index:7}
html body .pc-layer .pc-guest-hit{left:63.5%!important;right:auto!important;bottom:30%!important;translate:-50% 0}
html body .scene .pc-layer .tag.pc-gtag{left:63.5%!important;right:auto!important;translate:-50% 0;bottom:calc(30% + max(44px,10cqw) + 3px)!important}
html body .pc-layer .pc-cat-hit{bottom:30%!important}
html body .scene .tags .tag.cat-tag{bottom:calc(30% + max(44px,9cqw) + 3px)!important}
/* 阿栗只画按钮的 75%，与本人区分；触控区不变 */
html body .pc-layer .pc-cat-hit::after{inset:25% 12.5% 0 12.5%}
/* TOWN_PARK_DONE */
/* TOWN_SIGN */
@media (max-width:600px){html body .scene .tags .tag.park{bottom:66%!important;left:78%!important}}
/* TOWN_SIGN_END */
