/* Backpack frame and shop PNG layers shared with the existing game UI. */
#panel-overlay:has(#game-window[data-panel="pets"]){z-index:55;padding:12px 24px;align-items:center;justify-content:center;background:#17332036;backdrop-filter:blur(2px)}
#game-window[data-panel="pets"]{--pu:min(.078125vw,.138889dvh,1.2px);position:relative;width:calc(1180 * var(--pu));height:calc(690 * var(--pu));max-width:96vw;max-height:96dvh;overflow:visible;border:0;border-radius:0;background:url("../assets/ui-user/bag-frame.png") center / 100% 100% no-repeat;box-shadow:none;color:#9e5c30;font-size:16px;font-weight:800;letter-spacing:0}
#game-window[data-panel="pets"] .window-header{position:absolute;inset:0;height:0;min-height:0;padding:0;margin:0;border:0;pointer-events:none;z-index:5}
#game-window[data-panel="pets"] .window-header>div{position:absolute;left:17%;top:calc(36 * var(--pu));width:20%;height:calc(71 * var(--pu));justify-content:center}
#game-window[data-panel="pets"] .window-header h1{color:#a83222;font-size:36px;font-weight:900;letter-spacing:0;text-shadow:2px 0 #fff2bf,-2px 0 #fff2bf,0 2px #fff2bf,0 -2px #fff2bf;white-space:nowrap;line-height:1.2}
#game-window[data-panel="pets"] #window-icon,#game-window[data-panel="pets"] .window-footer{display:none}
#game-window[data-panel="pets"] #panel-close{position:absolute;right:calc(-15 * var(--pu));top:calc(161 * var(--pu));width:calc(122 * var(--pu));height:calc(86 * var(--pu));min-width:44px;min-height:44px;padding:0;border:0;border-radius:0;background:url("../assets/ui-user/bag-close.png") right center / auto 100% no-repeat;font-size:0;pointer-events:auto}
#game-window[data-panel="pets"] #panel-content{padding:calc(143 * var(--pu)) calc(94 * var(--pu)) calc(36 * var(--pu)) calc(94 * var(--pu));overflow:hidden}
.pet-layout{position:relative;display:grid;grid-template-columns:minmax(0,1.93fr) minmax(0,1fr);grid-template-rows:154px minmax(0,1fr);grid-template-areas:"roster detail" "workspace detail";column-gap:26px;row-gap:12px;height:100%;min-height:0;padding:22px 24px 22px 30px;border-radius:40px;background:#fff3bd;isolation:isolate}
.pet-layout::before{content:"";position:absolute;inset:18px 16px 16px 18px;background:url("../assets/ui-user/bag-list-detail.png") center / 100% 100% no-repeat;z-index:-1;pointer-events:none}
.pet-layout *{box-sizing:border-box;letter-spacing:0;min-width:0}
.pet-layout h2,.pet-layout h3,.pet-layout p,.pet-layout dl{margin:0}
.pet-layout button{color:inherit;font-weight:800;line-height:1.3;min-height:40px;transition:filter .15s,transform .15s}
.pet-layout button:hover:not(:disabled){filter:brightness(1.06)}
.pet-layout button:active:not(:disabled){transform:translateY(2px)}
.pet-layout button:focus-visible,.pet-layout input:focus-visible,.pet-layout select:focus-visible{outline:3px solid #a84b2d;outline-offset:2px}
.pet-layout button:disabled{opacity:.5;cursor:default}
.pet-roster{grid-area:roster;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;min-height:0}
.pet-roster-item{display:flex;flex-direction:column;align-items:center;gap:2px;position:relative;min-height:0!important;padding:0 3px;border:0;border-radius:0;background:none;box-shadow:none}
.pet-roster-art{display:block;width:90px;height:90px;flex:none;border-radius:50%;background:url("../assets/ui-user/shop-item-bg.png") center / contain no-repeat}
.pet-roster-item.selected .pet-roster-art{outline:3px solid #f39906;outline-offset:-2px;filter:drop-shadow(0 2px 3px #a9602538)}
.pet-roster-art>.pet-portrait{display:block;width:100%;height:100%;object-fit:contain;transform:scale(1.05)}
.pet-roster-item strong{font-size:18px;color:#a34225;line-height:1.3;text-shadow:0 1px #fff3bd}
.pet-roster-item small{font-size:12px;line-height:1.4;overflow-wrap:anywhere;text-align:center}
.pet-roster-status{font-size:11px;line-height:1.4;color:#956444;padding:1px 9px}
.pet-roster-status.carried{color:#fff8d7;background:#719b60;border-radius:12px}
.pet-detail{grid-area:detail;display:flex;flex-direction:column;align-items:stretch;gap:10px;min-height:0;padding:0 4px}
.pet-profile{display:flex;flex-direction:column;align-items:center;flex:none;gap:4px}
.pet-preview{width:145px;height:124px;position:relative;background:url("../assets/ui-user/bag-preview.png") center / 100% 100% no-repeat}
.pet-main-portrait{position:absolute;left:0;top:-12px;width:100%;height:145px;object-fit:contain;filter:drop-shadow(0 5px 2px #a76a2530)}
.pet-profile h2{max-width:100%;font-size:24px;line-height:1.2;padding:7px 23px;text-align:center;overflow-wrap:anywhere;background:url("../assets/ui-user/bag-title.png") center / 100% 100% no-repeat;color:#fff0b5;font-weight:900}
.pet-form{font-size:12px;line-height:1.4;padding:2px 10px;color:#a36739;background:#fff0bb;border-radius:12px}
.pet-detail-scroll{flex:1;min-height:0;overflow:auto;padding:0 4px 2px}
.pet-vitals{padding:0 0 10px}
.pet-hunger-label,.pet-mutation-label{display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap;font-size:13px;line-height:1.5}
.pet-mutation-label{margin-top:9px}
.pet-mutation-rule{display:block;margin-top:3px;font-size:11px;line-height:1.4;overflow-wrap:anywhere;color:#85613e}
.pet-detail progress{display:block;appearance:none;width:100%;height:10px;overflow:hidden;border:0;border-radius:8px;background:#fff1bc;margin-top:4px}
.pet-detail progress::-webkit-progress-bar{background:#fff1bc}.pet-detail progress::-webkit-progress-value{background:#7da253;border-radius:8px}
.pet-buff{border-top:3px solid #fff1b7;padding:9px 0 0}
.pet-buff h3{display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap;font-size:17px;line-height:1.4;color:#a34225}
.pet-buff h3 span{font-size:13px;overflow-wrap:anywhere;color:#9e5c30}
.pet-buff p{font-size:14px;line-height:1.55;margin:5px 0;overflow-wrap:anywhere}
.pet-buff small{font-size:12px;color:#85613e}
.pet-detail-actions{display:flex;flex-direction:column;gap:7px;flex:none;padding-top:3px}
.pet-detail-actions button,.pet-primary{border:0;border-radius:24px;background:#e65c46;color:#fff2bc;padding:10px 14px;font-size:17px;box-shadow:0 3px 0 #b6482a26}
.pet-detail-actions .pet-upgrade{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:5px;background:#fff0b5;color:#a95d28;font-size:15px;border:2px solid #edb14a;padding:7px 12px}
.pet-upgrade strong{display:flex;align-items:center;gap:3px;font-size:14px;overflow-wrap:anywhere}
.pet-upgrade img{width:23px;height:23px;object-fit:contain;flex:none}
.pet-detail-actions .pet-carry:disabled{background:#8fa865;color:#fff8d7;opacity:1}
.pet-workspace{grid-area:workspace;display:flex;flex-direction:column;min-height:0;gap:10px}
.pet-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;flex:none}
.pet-tabs button{display:flex;align-items:center;justify-content:center;gap:6px;height:46px;min-height:44px;padding:5px 8px;border:0;border-radius:0;background:url("../assets/ui-user/shop-sell-label-bg.png") center / 100% 100% no-repeat;color:#9d6b33;font-size:17px}
.pet-tabs button.selected{background-image:url("../assets/ui-user/bag-title.png");color:#fff2bc;filter:drop-shadow(0 2px 0 #bb7f3725)}
.pet-tabs .crop-icon{height:28px;width:28px;object-fit:contain;flex:none}
.pet-feeding,.pet-work,.pet-collection{display:flex;flex-direction:column;min-height:0;flex:1}
.pet-section-heading{display:flex;align-items:center;justify-content:space-between;gap:6px;flex-wrap:wrap;padding:0 3px 8px;flex:none}
.pet-section-heading h3{font-size:16px;color:#a34225;line-height:1.4}
.pet-section-heading>span{font-size:11px;line-height:1.5;color:#9e6a3d}
.pet-food-list,.pet-effect-list{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-auto-rows:min-content;gap:10px 6px;flex:1;min-height:0;overflow:auto;padding:5px 6px;scrollbar-gutter:stable}
.pet-food,.pet-effect{position:relative;display:flex;flex-direction:column;align-items:center;gap:3px;padding:3px 2px 6px;border:0;border-radius:0;background:none;box-shadow:none;text-align:center}
.pet-food-art{display:grid;place-items:center;width:65px;height:65px;flex:none;border-radius:50%;background:url("../assets/ui-user/shop-item-bg.png") center / contain no-repeat}
.pet-food-art>.crop-icon{width:88%;height:88%;object-fit:contain}
.pet-food.selected .pet-food-art{outline:3px solid #ef9c0c;outline-offset:-2px}
.pet-food strong,.pet-effect strong{font-size:13px;line-height:1.4;overflow-wrap:anywhere;max-width:100%}
.pet-food small,.pet-effect small{font-size:11px;line-height:1.4;overflow-wrap:anywhere;max-width:100%}
.pet-food em{position:absolute;right:0;top:0;font-size:10px;font-style:normal;color:#fff3cf;background:#bd6896;padding:2px 5px;border-radius:9px}
.pet-food .pet-food-locked{background:#9b805a}
.pet-feed-footer{display:flex;align-items:center;gap:10px;flex:none;padding:10px 4px 0;border-top:2px solid #fff0b5;margin-top:6px}
.pet-feed-footer label{font-size:15px;flex:none}
.pet-feed-footer input{width:70px;min-width:0;height:40px;padding:6px 5px;border:2px solid #edb14a;border-radius:12px;background:#fff3bd;color:#9e5c30;text-align:center;font-size:17px;font-weight:800}
.pet-feed-footer .pet-primary{margin-left:auto;min-width:100px;color:#fff2bc}
.pet-empty{grid-column:1/-1;align-self:center;justify-self:center;text-align:center;padding:16px 5px;color:#a37748;font-size:14px;font-weight:700}
.pet-empty>.crop-icon{display:block;width:58px;height:58px;margin:0 auto 10px;object-fit:contain;opacity:.7}
.pet-work-scroll{min-height:0;overflow:auto;padding:0 6px 3px}
.pet-toggle,.pet-select{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 0;font-size:14px;line-height:1.4;border-bottom:2px solid #fff0b5}
.pet-toggle input{appearance:none;position:relative;width:42px;height:25px;border:2px solid #d49f57;border-radius:20px;background:#fff1bd;flex:none;cursor:pointer}
.pet-toggle input::before{content:"";position:absolute;left:2px;top:2px;width:17px;height:17px;border-radius:50%;background:#c28a4c;transition:transform .15s}
.pet-toggle input:checked{background:#8bae62;border-color:#70944b}.pet-toggle input:checked::before{background:#fff8d6;transform:translateX(17px)}
.pet-toggle input:disabled,.pet-select select:disabled{opacity:.5;cursor:default}
.pet-select select{max-width:65%;width:240px;padding:7px;border:2px solid #edb14a;border-radius:8px;background:#fff3bd;color:#9e5c30;font-family:inherit;font-size:13px;font-weight:700}
.pet-work-facts{margin-top:12px!important;display:grid;grid-template-columns:1fr 1fr;gap:10px;font-size:12px;line-height:1.5}
.pet-work-facts dt{color:#ac7948}.pet-work-facts dd{margin:2px 0 0}
.pet-catalysis-controls{border-bottom:2px solid #f1c365}
.pet-catalysis-controls>.pet-select{border-bottom:0}
.pet-catalysis-status{display:block;font-size:11px;font-weight:700;line-height:1.45;color:#85613e;min-height:16px;margin-top:3px;overflow-wrap:anywhere}
.pet-catalysis-facts{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 12px}
.pet-catalysis-facts :is(dt,dd){overflow-wrap:anywhere}
.pet-catalysis-rule,.pet-catalysis-exclusive{font-size:11px;line-height:1.5;color:#85613e;overflow-wrap:anywhere}
.pet-work-scroll>.pet-catalysis-rule{margin:8px 0 0}
.pet-work-scroll>.pet-catalysis-exclusive{padding:10px 0;border-bottom:2px solid #fff0b5}
.pet-buff-catalysis{display:grid;gap:5px;margin:8px 0!important;font-size:11px;line-height:1.45}
.pet-buff-catalysis>div{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:6px}
.pet-buff-catalysis dt{font-weight:700;color:#85613e}
.pet-buff-catalysis dd{margin:0;text-align:end;overflow-wrap:anywhere}
.pet-effect-list{grid-template-columns:repeat(3,minmax(0,1fr))}
.pet-layout :is(.pet-food-list,.pet-effect-list,.pet-detail-scroll,.pet-work-scroll){scrollbar-color:#f6a20e transparent;scrollbar-width:thin;overscroll-behavior:contain}
#pet-shortcut img{object-fit:contain}
.hud-system #pet-shortcut{position:absolute;right:calc(100% + 10px);top:0}
@media(max-width:1050px) and (min-width:701px){
 #game-window[data-panel="pets"]{width:96vw;height:94dvh}
 #game-window[data-panel="pets"] .window-header h1{font-size:28px}
 #game-window[data-panel="pets"] #panel-content{padding:calc(132 * var(--pu)) 7% 3%}
 .pet-layout{padding:16px 18px;column-gap:16px;grid-template-rows:140px minmax(0,1fr)}
 .pet-roster-art{width:78px;height:78px}.pet-roster-item strong{font-size:16px}
 .pet-food-list{grid-template-columns:repeat(3,minmax(0,1fr))}.pet-preview{width:128px;height:106px}.pet-main-portrait{height:128px}
 .pet-profile h2{font-size:22px}.pet-detail{gap:7px}
}
@media(max-width:700px){
 #panel-overlay:has(#game-window[data-panel="pets"]){padding:6px}
 #game-window[data-panel="pets"]{--pu:1px;width:100%;max-width:100%;height:97dvh;max-height:97dvh;background-size:auto calc(100% - 45px);background-position:right bottom}
 #game-window[data-panel="pets"] .window-header>div{left:22px;top:12px;width:174px;height:100px;background:url("../assets/ui-user/bag-frame.png") 20% top / auto 480px no-repeat}
 #game-window[data-panel="pets"] .window-header h1{font-size:24px}
 #game-window[data-panel="pets"] #panel-close{top:91px;right:0;width:62px;height:46px}
 #game-window[data-panel="pets"] #panel-content{position:absolute;inset:132px 0 18px;padding:0 19px;overflow:auto}
 .pet-layout{grid-template-columns:minmax(0,1fr);grid-template-rows:auto;grid-template-areas:"roster" "detail" "workspace";height:auto;min-height:100%;padding:18px 12px 20px;border-radius:25px;gap:20px;background:#fff3bd}
 .pet-layout::before{display:none}
 .pet-roster{padding-bottom:14px;border-bottom:3px solid #f7d38d;gap:3px}
 .pet-roster-art{width:74px;height:74px}.pet-roster-item strong{font-size:15px}.pet-roster-item small{font-size:11px}.pet-roster-status{font-size:10px;padding:2px 4px}
 .pet-detail{display:grid;grid-template-columns:112px minmax(0,1fr);gap:12px 10px;padding:0}
 .pet-preview{width:110px;height:110px}.pet-main-portrait{top:-5px;height:115px}
 .pet-profile h2{font-size:18px;padding:7px 12px}.pet-form{font-size:11px}
 .pet-detail-scroll{overflow:visible;padding:0}.pet-vitals{padding-bottom:9px}
 .pet-hunger-label,.pet-mutation-label{font-size:11px;gap:3px}.pet-mutation-label{margin-top:8px}
 .pet-buff h3{font-size:15px;gap:2px}.pet-buff h3 span{font-size:11px}.pet-buff p{font-size:12px;line-height:1.5;margin:4px 0}.pet-buff small{font-size:10px}
 .pet-detail-actions{grid-column:1/-1;display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr);gap:8px}
 .pet-detail-actions button{font-size:15px;padding:8px}.pet-detail-actions .pet-upgrade{font-size:13px;padding:7px 9px}.pet-upgrade strong{font-size:12px}
 .pet-workspace{min-height:340px;gap:12px;border-top:3px solid #f7d38d;padding-top:13px}
 .pet-tabs{gap:3px}.pet-tabs button{font-size:16px;gap:4px;padding:5px}.pet-tabs .crop-icon{width:25px;height:25px}
 .pet-section-heading{padding-bottom:10px}.pet-section-heading h3{font-size:15px}.pet-section-heading>span{font-size:10px}
 .pet-food-list,.pet-effect-list{grid-template-columns:repeat(3,minmax(0,1fr));flex:none;max-height:280px;min-height:130px;padding:5px 4px;gap:12px 4px}
 .pet-food-art{width:65px;height:65px}.pet-food strong,.pet-effect strong{font-size:12px}.pet-food small,.pet-effect small{font-size:10px}
 .pet-feed-footer{margin-top:10px;padding-top:12px}.pet-feed-footer .pet-primary{min-width:105px}
 .pet-work-scroll{overflow:visible}.pet-select{font-size:13px}.pet-select select{max-width:65%;font-size:12px}
}
@media(min-width:701px) and (max-height:620px){
 #game-window[data-panel="pets"]{--pu:.72px;width:min(1050px,95vw);height:96dvh;max-height:96dvh}
 #game-window[data-panel="pets"] .window-header>div{top:20px;height:48px}
 #game-window[data-panel="pets"] .window-header h1{font-size:25px}
 #game-window[data-panel="pets"] #panel-content{padding:100px 7% 18px;overflow:auto}
 #game-window[data-panel="pets"] #panel-close{top:110px;width:70px;height:53px}
 .pet-layout{height:450px;min-height:100%;padding:16px 20px;grid-template-rows:132px minmax(0,1fr);column-gap:20px}
 .pet-roster-art{width:72px;height:72px}.pet-roster-item strong{font-size:16px}
 .pet-preview{width:112px;height:90px}.pet-main-portrait{height:112px}
 .pet-profile h2{font-size:20px;padding:5px 18px}.pet-detail{gap:7px}.pet-detail-actions button{padding:7px 10px}
}
@media(prefers-reduced-motion:reduce){.pet-layout button,.pet-toggle input::before{transition:none}}

/* Translated names and Vietnamese accents must fit the original bitmap layout. */
:is(html:lang(en),html:lang(vi)) #game-window[data-panel="pets"] .pet-roster-item strong,
:is(html:lang(en),html:lang(vi)) #game-window[data-panel="pets"] .pet-roster-status{max-width:100%;overflow-wrap:anywhere;text-align:center}
:is(html:lang(en),html:lang(vi)) #game-window[data-panel="pets"] .pet-tabs button span{max-width:100%;overflow-wrap:anywhere;line-height:1.15;text-align:center}
:is(html:lang(en),html:lang(vi)) #game-window[data-panel="pets"] .pet-feed-footer label{flex:0 1 auto;overflow-wrap:anywhere}
:is(html:lang(en),html:lang(vi)) #game-window[data-panel="pets"] .pet-toggle>span,
:is(html:lang(en),html:lang(vi)) #game-window[data-panel="pets"] .pet-select>span{min-width:0;overflow-wrap:anywhere}
:is(html:lang(en),html:lang(vi)) #game-window[data-panel="pets"] .pet-select select{flex:1 1 55%;min-width:0}
:is(html:lang(en),html:lang(vi)) #game-window[data-panel="pets"] .pet-work-facts{grid-template-columns:repeat(2,minmax(0,1fr));overflow-wrap:anywhere}
@media(max-width:380px) and (orientation:portrait),(max-height:500px) and (orientation:landscape){
 :is(html:lang(en),html:lang(vi)) #game-window[data-panel="pets"] .pet-roster-art{width:28px;height:28px}
 :is(html:lang(en),html:lang(vi)) #game-window[data-panel="pets"] .pet-roster-item strong{font-size:11px;line-height:1.2}
 :is(html:lang(en),html:lang(vi)) #game-window[data-panel="pets"] .pet-roster-item small,
 :is(html:lang(en),html:lang(vi)) #game-window[data-panel="pets"] .pet-roster-status{font-size:9px;line-height:1.2}
 :is(html:lang(en),html:lang(vi)) #game-window[data-panel="pets"] .pet-tabs button{font-size:11px;gap:2px}
 :is(html:lang(en),html:lang(vi)) #game-window[data-panel="pets"] .pet-profile h2{font-size:13px;line-height:1.25;padding:3px 5px}
}
