/* ===== V3.5.3 村莊比例與角色破圖修正版 ===== */
.character-img{display:block;max-width:100%;max-height:100%;object-fit:contain;user-select:none;-webkit-user-drag:none}
.hero-style-picker{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:8px}
.hero-style-option{position:relative;cursor:pointer}
.hero-style-option input{position:absolute;opacity:0;pointer-events:none}
.hero-style-card{display:grid;grid-template-columns:78px 1fr;align-items:center;gap:10px;min-height:94px;padding:9px 12px;border:3px solid #d3cab5;border-radius:15px;background:#fffaf0;transition:transform .15s,border-color .15s,box-shadow .15s}
.hero-style-card img{width:76px;height:76px;object-fit:contain;filter:drop-shadow(0 3px 0 rgba(0,0,0,.11))}
.hero-style-card b{display:block;font-size:16px}.hero-style-card small{display:block;color:#776c58;line-height:1.5;margin-top:3px}
.hero-style-option:hover .hero-style-card{transform:translateY(-2px)}
.hero-style-option input:checked+.hero-style-card{border-color:#e6a31a;box-shadow:0 0 0 4px rgba(230,163,26,.15);background:#fff6d9}
.profile-avatar{height:82px;display:grid;place-items:center}.profile-avatar img{width:82px;height:82px;object-fit:contain;filter:drop-shadow(0 4px 0 rgba(0,0,0,.12))}
.hero-avatar{overflow:visible!important}.hero-avatar img{width:72px;height:72px;object-fit:contain;filter:drop-shadow(0 4px 0 rgba(0,0,0,.13))}
.character-map-img{width:48px;height:48px;object-fit:contain;filter:drop-shadow(0 3px 0 rgba(0,0,0,.16));pointer-events:none}
.character-walk-sprite{position:relative;display:block;width:50px;height:50px;pointer-events:none}
.character-walk-sprite .character-frame{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 3px 0 rgba(0,0,0,.16))}
.character-walk-sprite .frame-a{animation:characterWalkA .56s steps(1,end) infinite}
.character-walk-sprite .frame-b{animation:characterWalkB .56s steps(1,end) infinite}
@keyframes characterWalkA{0%,49%{opacity:1}50%,100%{opacity:0}}
@keyframes characterWalkB{0%,49%{opacity:0}50%,100%{opacity:1}}
.world-villager .face{width:50px;height:50px;display:grid;place-items:center;font-size:0!important;line-height:1}
.world-villager.hero .face{width:56px;height:56px}.world-villager.hero .character-walk-sprite{width:56px;height:56px}
.world-villager.dragon .face{width:62px;height:62px}.world-villager.dragon .character-walk-sprite{width:62px;height:62px}
.world-villager .body{min-width:56px}.world-villager .name{position:relative;z-index:4;transform:none!important}
.world-villager .character-map-img{animation:characterIdle 2s ease-in-out infinite}
@keyframes characterIdle{0%,100%{transform:translateY(0)}50%{transform:translateY(-1px)}}
.npc-dialog{grid-template-columns:102px 1fr!important;min-height:126px;overflow:hidden}
.npc-face{width:96px;height:112px;font-size:0!important;display:flex;align-items:flex-end;justify-content:center;align-self:end}
.npc-face .character-portrait-img{width:100%;height:112px;object-fit:contain;object-position:center bottom;filter:drop-shadow(0 3px 0 rgba(0,0,0,.11))}
.resident-face{height:62px;font-size:0!important;display:grid;place-items:center}.resident-face img{width:62px;height:62px;object-fit:contain;filter:drop-shadow(0 3px 0 rgba(0,0,0,.14))}
.relationship-face{width:72px;height:78px;font-size:0!important;display:grid;place-items:end center}.relationship-face img{width:72px;height:78px;object-fit:contain;object-position:center bottom;filter:drop-shadow(0 3px 0 rgba(0,0,0,.12))}
.relationship-head{grid-template-columns:76px 1fr auto!important}
.building-room-owner .face,.building-room-hero .face{width:76px;height:80px;font-size:0!important;display:grid;place-items:end center}
.building-room-owner .face img,.building-room-hero .face img{width:76px;height:80px;object-fit:contain;object-position:center bottom;filter:drop-shadow(0 3px 0 rgba(0,0,0,.14))}
.world-hub-hero .hero-face,.portable-home-hero .face{width:72px;height:72px;font-size:0!important;display:grid;place-items:end center;margin:auto}
.world-hub-hero .hero-face img,.portable-home-hero .face img{width:72px;height:72px;object-fit:contain;filter:drop-shadow(0 3px 0 rgba(0,0,0,.14))}
.equipment-art{width:28px;height:28px;object-fit:contain;filter:drop-shadow(0 2px 0 rgba(0,0,0,.12))}
.item-ico{display:grid!important;place-items:center}.item-ico .equipment-art{width:48px;height:48px}
.hero-equip.art{display:grid;place-items:center;width:25px;height:25px;background:rgba(255,255,255,.86);border:2px solid rgba(255,209,102,.85);border-radius:50%;padding:2px;z-index:6}
.hero-equip.art img{width:100%;height:100%;object-fit:contain}.hero-equip.art.hat{top:-12px;left:8px;transform:none}.hero-equip.art.face-item{top:2px;left:43px;transform:none}.hero-equip.art.cape{top:28px;left:-11px}.hero-equip.art.weapon{top:30px;right:-15px;transform:rotate(10deg)}.hero-equip.art.accessory{top:54px;left:-5px}
.hero-companion.art{right:-34px;top:13px;width:31px;height:31px;font-size:0}.hero-companion.art img{width:31px;height:31px;object-fit:contain}
.character-loading-note{font-size:11px;color:#756e5b;margin-top:5px}
@media(max-width:600px){
  .hero-style-picker{grid-template-columns:1fr}.hero-style-card{grid-template-columns:68px 1fr}.hero-style-card img{width:66px;height:66px}
  .npc-dialog{grid-template-columns:78px 1fr!important;padding:11px 12px}.npc-face{width:72px;height:92px}.npc-face .character-portrait-img{height:92px}
  .relationship-head{grid-template-columns:62px 1fr!important}.relationship-face{width:60px;height:66px}.relationship-face img{width:60px;height:66px}
  .world-villager .face,.character-walk-sprite{width:44px;height:44px}.world-villager.hero .face,.world-villager.hero .character-walk-sprite{width:50px;height:50px}
}
@media(prefers-reduced-motion:reduce){.character-walk-sprite .character-frame,.world-villager .character-map-img{animation:none}.character-walk-sprite .frame-b{display:none}}

.character-image-fallback{display:inline-grid;place-items:center;width:100%;height:100%;font-size:clamp(24px,8vw,56px);line-height:1;filter:drop-shadow(0 3px 0 rgba(0,0,0,.14))}

/* V5.0Y 四世界居民完整 Q 版立繪統一 */
.character-portrait-img,.world-resident-portrait{object-fit:contain!important;object-position:center bottom!important;max-width:100%;max-height:100%}
.npc-face .character-portrait-img,.relationship-face .character-portrait-img{width:100%!important;height:100%!important;padding:2px;box-sizing:border-box}
.world-resident-card .face{overflow:visible!important}
.world-resident-card .world-resident-portrait{width:74px!important;height:74px!important}
.resident-interaction-portrait img{width:100%!important;height:100%!important;object-fit:contain!important;object-position:center bottom!important}

.profile-avatar .profile-character-image{width:82px;height:82px;object-fit:contain;object-position:center top;filter:drop-shadow(0 4px 0 rgba(0,0,0,.12))}

/* V5.0AH：主角卡片與玩家清單改用安全顯示尺寸，避免頭髮被切到或看起來破圖 */
.hero-avatar{overflow:hidden!important;align-items:center;justify-items:center}
.hero-avatar img{width:56px;height:56px;object-fit:contain;object-position:center center;filter:drop-shadow(0 2px 0 rgba(0,0,0,.08))}
.home-hero-portrait{width:56px;height:56px;object-fit:contain;object-position:center center;filter:drop-shadow(0 2px 0 rgba(0,0,0,.08))}
.profile-avatar img,.profile-avatar .profile-character-image{width:74px;height:74px;object-fit:contain;object-position:center center;filter:drop-shadow(0 2px 0 rgba(0,0,0,.08))}
.world-hub-hero .hero-face img{filter:drop-shadow(0 2px 0 rgba(0,0,0,.08))}


/* V5.1C1：四世界居民列表統一全身站立圖，保留完整四肢與配件 */
.resident-card .resident-face{height:98px;min-height:98px;overflow:visible!important;display:grid;place-items:center}
.resident-card .resident-fullbody-image,
.world-resident-list .resident-fullbody-image,
.resident-card .resident-list-image,
.world-resident-list .resident-list-image{
  width:88px!important;
  height:94px!important;
  max-width:96%!important;
  max-height:96%!important;
  object-fit:contain!important;
  object-position:center bottom!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
  filter:drop-shadow(0 3px 2px rgba(0,0,0,.15))!important;
}
.world-resident-list .resident-card{min-height:180px}
@media(max-width:700px){
  .resident-card .resident-face{height:84px;min-height:84px}
  .resident-card .resident-fullbody-image,
  .world-resident-list .resident-fullbody-image,
  .resident-card .resident-list-image,
  .world-resident-list .resident-list-image{width:76px!important;height:80px!important}
  .world-resident-list .resident-card{min-height:158px}
}
