/* 購物商店（shop.js）：原版購物商店版面。右欄面板是商品區（大分頁＋小分頁＋排序＋商品卡），
   寬螢幕的試穿面板放在大廳左欄（取代左欄格子，見下方 .lb-aside）；窄螢幕試穿面板在清單上方，大廳格子收起來（#lobby.sh-open）。 */
#lobby.sh-open .lb-stage{position:absolute;left:-10000px;top:0;bottom:0;width:420px;visibility:hidden;pointer-events:none}   /* 移到畫面外（不用 display:none：格子動畫、進場特效照常跑） */
.sh{display:flex;gap:12px;align-items:flex-start;min-height:100%}
.sh-main{flex:1;min-width:0}

/* 大分頁（主商品／道具／角色／櫥窗／套裝組合）＋收藏星星＋搜尋 */
.sh-top{display:flex;align-items:flex-end;gap:6px;flex-wrap:wrap;margin-bottom:6px}
.sh-tabs{display:flex;gap:3px;flex-wrap:wrap}
.sh-tab{padding:6px 12px 7px;border:3px solid #fff;border-bottom:0;border-radius:10px 10px 0 0;cursor:pointer;font-family:inherit;font-weight:900;font-size:14px;
  color:#e8f6ff;background:linear-gradient(180deg,#2f8cf0,#0a5cc8);text-shadow:0 1px 0 #06306e;white-space:nowrap}
.sh-tab:hover{filter:brightness(1.12)}
.sh-tab.on{background:linear-gradient(180deg,#7fe0ff,#2ab0ff);color:#fff;box-shadow:inset 0 -3px 0 #1a8ae0}
.sh-star{color:#ffe15a;font-size:16px;padding:5px 10px 6px}
.sh-star.on{background:linear-gradient(180deg,#ffe86b,#ffae1f);color:#fff}
.sh-search{margin-left:auto;width:150px;font-family:inherit;font-size:13px;font-weight:800;color:var(--lb-ink);padding:5px 10px;border-radius:12px;border:2px solid var(--lb-line);background:#fff}
.sh-note{display:flex;flex-wrap:wrap;gap:2px 10px;align-items:baseline;padding:5px 10px;margin-bottom:6px;border-radius:10px;background:#fff;border:2px solid #9cd0ff;font-size:11px;font-weight:700;color:#4a6b9a}
.sh-note b{color:#1462c8;font-size:13px}

/* 頂部（大分頁＋收集加成＋小分頁）：往下捲時固定在面板頂端，不用捲回去才能換分頁 */
/* top 抵掉面板上方的 14px 內距，捲動時卡片不會從分頁上面露出來；margin/padding 一加一減，沒捲時位置不變 */
.sh-head{position:sticky;top:-14px;z-index:6;margin:-14px -4px 6px;padding:14px 4px 0;background:#e3f4ff;border-bottom:2px solid #b8dcff;border-radius:0 0 12px 12px}
.sh-head .sh-bar{margin-bottom:6px}
/* 小分頁＋排序 */
.sh-bar{display:flex;align-items:center;gap:6px;flex-wrap:wrap;padding:6px 8px;margin-bottom:8px;border-radius:12px;background:linear-gradient(180deg,#7fd8ff,#3fb2f6);border:2px solid #fff}
.sh-subs{display:flex;gap:4px;flex-wrap:wrap;flex:1;min-width:0}
.sh-bar .sq-sub{padding:3px 10px;font-size:13px;border-width:2px;box-shadow:0 2px 0 #1a5bb0}
.sh-bar .sq-sub small{font-size:10px;color:#fff;background:rgba(0,40,120,.35)}
.sh-bar .sq-sub.on small{color:#6a3000;background:rgba(255,255,255,.5)}
.sh-sort{margin-left:auto;font-family:inherit;font-size:12px;font-weight:900;color:#fff;padding:4px 8px;border-radius:10px;border:2px solid #fff;background:#1462c8}
.sh-desc{font-size:12px;font-weight:700;color:#4a6b9a;margin:0 2px 8px}
.sh-desc .sh-cl{margin:0 4px;white-space:nowrap}
.sh-empty{grid-column:1/-1;padding:26px;text-align:center;font-weight:800;color:#4a6b9a}
.sh-sec h4{display:flex;align-items:baseline;gap:8px}
.sh-sec{margin-bottom:12px}

/* 商品卡：左邊方形縮圖、右邊名稱／價格／按鈕／收藏星星（2～3 欄依寬度） */
.sh-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(max(236px,31%),1fr));gap:8px}
.sh-card{position:relative;display:flex;gap:8px;padding:6px;border-radius:12px;cursor:pointer;
  background:linear-gradient(180deg,#2b8ff0,#1462c8);border:3px solid #9fdcff;box-shadow:0 3px 0 #0b3f96;color:#fff;min-width:0}
.sh-card:hover{border-color:#fff}
.sh-card.pv{border-color:#ffe15a;box-shadow:0 0 0 2px #ffe15a,0 3px 0 #0b3f96}
.sh-card.cur{border-color:#ffd21f}
.sh-card.cur::after{content:"";position:absolute;top:-9px;right:-8px;z-index:2;width:24px;height:24px;pointer-events:none;
  background:url(fx/ui_check.png) center/contain no-repeat;filter:drop-shadow(0 1px 1px rgba(0,0,0,.3))}
.sh-th{position:relative;flex:none;width:72px;height:72px;border-radius:9px;background:radial-gradient(circle at 50% 45%,#4a86e8,#123a9a 75%);border:3px solid #fff;
  box-sizing:border-box;display:grid;place-items:center;overflow:hidden}
.sh-th.bg,.sh-th.entry{background:#0c2a8a}
.sh-th img{max-width:64px;max-height:64px;image-rendering:pixelated}
.sh-th-i{display:block;width:64px;height:64px;background-repeat:no-repeat;image-rendering:pixelated}
.sh-set{position:absolute;right:1px;bottom:1px;padding:0 3px;border-radius:3px;background:#0b2a7e;color:#fff;font-size:9px;font-weight:900;letter-spacing:.5px;border:1px solid #9fdcff}
.sh-inf{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
.sh-nm{display:flex;align-items:center;gap:4px;padding:1px 6px;border-radius:6px;background:rgba(0,30,110,.45);font-weight:900;font-size:13px;color:#b8ffb0;min-width:0}
.sh-nm>span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sh-item .sh-nm,.sh-char .sh-nm{color:#fff}
.sh-fav{flex:none;padding:0;border:0;background:none;cursor:pointer;font-size:16px;line-height:1;color:rgba(255,255,255,.45);text-shadow:0 1px 0 rgba(0,0,0,.3)}
.sh-fav.on{color:#ffe15a}
.sh-meta{display:flex;align-items:center;gap:4px;flex-wrap:wrap;font-size:11px;font-weight:800}
.sh-kind{padding:0 6px;border-radius:8px;background:rgba(255,255,255,.2);white-space:nowrap}
.sh-price{display:inline-flex;align-items:center;gap:2px;font-size:13px;font-weight:900;color:#fff3a0;white-space:nowrap}
.sh-price img{width:13px;height:13px}
.sh-price s{margin-left:4px;font-size:10px;color:#cfe6ff}
.sh-price.off{color:#ffd0da}
.sh-ds{font-size:11px;font-weight:700;color:#dff1ff;line-height:1.35}
.sh-card .sq-btns{justify-content:flex-end;margin-top:auto}
.sh-card .sq-btns .lb-btn{padding:2px 9px;font-size:12px}
.sh-card .sq-btns .lb-btn.buy,.sh-card .sq-btns .lb-btn.on{padding:2px 10px}
.sh-card.notown .sh-th{filter:saturate(.85)}
/* 暫時不開放購買（shop_sale.js）：照樣列出、可以預覽；購買鈕變灰（點了跳提示，所以不用 disabled） */
.sh-card .sq-btns .lb-btn.buy.hold{background:linear-gradient(180deg,#c9d2de,#9aa6b6);color:#4d5868;border-color:#e6ebf2;box-shadow:0 2px 0 #7d8796;text-shadow:none;cursor:not-allowed;padding:2px 7px;font-size:11px;white-space:nowrap}
.sh-card .sq-btns .lb-btn.buy.hold:active{transform:none}
.sh-auto{font-size:11px!important;color:#fff!important;display:flex;align-items:center;gap:4px}
.sh-more{grid-column:1/-1;padding:10px;text-align:center;font-weight:800;color:#4a6b9a;cursor:pointer}
.sh-more[hidden]{display:none}

/* 右側預覽面板 */
.sh-side{position:sticky;top:0;flex:0 0 clamp(200px,25%,290px);max-height:calc(100vh - 180px);overflow-y:auto;scrollbar-width:thin;display:flex;flex-direction:column;gap:6px;padding:8px;border-radius:14px;
  background:linear-gradient(180deg,#2b8ff0,#0f56b8);border:3px solid #fff;box-shadow:0 4px 12px rgba(0,30,90,.3);box-sizing:border-box}
.sh-who-row{display:flex;align-items:center;gap:6px;color:#fff;font-size:12px;white-space:nowrap}
.sh-who-row select{flex:1;min-width:0}
.sh-slot{flex:none;width:100%;border-width:3px}
.sh-slot .lb-hero{z-index:2}
.sh-slot .sh-hero{position:relative;z-index:2;margin-bottom:10%;image-rendering:pixelated;transform-origin:50% 100%;animation:lbBreath 2.4s ease-in-out infinite}
.sh-plate{width:100%;height:30px;font-size:12px;color:#fff}
.sh-plate .nick{font-size:13px;cursor:default;border-bottom:0}
.sh-pv-btns{display:grid;grid-template-columns:1fr 1fr;gap:4px}
.sh-pv-btns .lb-btn{padding:3px 6px;font-size:12px}
.sh-pvtip{font-size:11px;font-weight:800;color:#cfe9ff;line-height:1.35;min-height:2.7em}
.sh-pvtip.on{color:#ffe15a}

/* 大廳格子新增的疊層：旗子（角色後面）、道具與格子效果（角色前面） */
.sq-slot>.sq-flag,.sq-slot>.sq-prop,.sq-slot>.sq-frame{position:absolute;inset:0;background-repeat:no-repeat;image-rendering:pixelated;pointer-events:none}
.sq-slot>.sq-flag{z-index:1}
.sq-slot>.sq-prop,.sq-slot>.sq-frame{z-index:3}
/* 名牌：階級章效果（徽章兩旁的光翼框） */
.lb-plate .sq-grw{position:relative;display:inline-grid;place-items:center;flex:none;width:32px;height:32px}
.lb-plate .sq-grw .gr{position:relative;z-index:1}
.lb-plate .sq-gfx{position:absolute;left:50%;top:50%;height:30px;transform:translate(-50%,-50%);background-repeat:no-repeat;image-rendering:pixelated;z-index:0;pointer-events:none}
.lb-plate .sq-gfx[hidden]{display:none}
/* 套裝：格子裡穿套裝的角色（取代待機動畫） */
.lb-hero.wearing .lb-char{display:none}
.lb-hero .sq-wear{position:relative;z-index:2;margin-bottom:10%;image-rendering:pixelated;cursor:pointer;pointer-events:auto;transform-origin:50% 100%;
  animation:lbBreath 2.4s ease-in-out infinite;filter:drop-shadow(0 3px 0 rgba(0,0,0,.2))}
.lb-hero .sq-wear.hop{animation:lbHop .5s cubic-bezier(.3,1.6,.5,1),lbBreath 2.4s ease-in-out .5s infinite}
.lb-hero .sq-wear[hidden]{display:none}

/* 寬螢幕：試穿面板在大廳左欄（.lb-aside）。排法跟大廳左欄一樣：左上格子、右邊選角色／名牌／按鈕／提示 */
#lobby .lb-aside .sh-side{position:static;max-height:none;overflow:visible;display:grid;grid-template-columns:var(--sq) minmax(0,1fr);
  grid-template-rows:auto auto auto 1fr;align-content:start;gap:6px 10px;padding:10px}
#lobby .lb-aside .sh-fold{display:none}
#lobby .lb-aside .sh-slot{grid-column:1;grid-row:1/span 4;width:var(--sq);box-sizing:border-box}
#lobby .lb-aside .sh-who-row,#lobby .lb-aside .sh-plate,#lobby .lb-aside .sh-pv-btns,#lobby .lb-aside .sh-pvtip{grid-column:2;min-width:0}
#lobby .lb-aside .sh-who-row{flex-wrap:wrap}
#lobby .lb-aside .sh-who-row select{min-width:0;width:100%}
#lobby .lb-aside .sh-plate{width:auto}
#lobby .lb-aside .sh-pvtip{min-height:0;overflow-wrap:anywhere}

@media (max-width:1100px){
  .sh-tab{padding:5px 9px 6px;font-size:13px}
  .sh-search{width:110px}
  .sh-side{flex-basis:200px}
}
/* 預覽面板在 DOM 裡排在前面（窄螢幕在上方），寬螢幕用 order 排回右邊；收合鈕只在窄螢幕出現 */
.sh-side{order:2}
.sh-main{order:1}
.sh-fold{display:none}
@media (max-width:700px),(max-width:900px) and (orientation:portrait){   /* 跟大廳手機直向同一組條件（平板直向也收合試穿） */
  .sh{flex-direction:column;gap:8px}
  .sh-side{order:0;position:static;flex:none;width:auto;max-height:none}
  .sh-fold{display:block;align-self:flex-end;font:inherit;font-size:12px;font-weight:800;padding:3px 10px;border-radius:10px;border:2px solid #fff;background:#0a6cd8;color:#fff;cursor:pointer}
  /* 預設收起：只剩一條「看試穿」鈕，商品一進來就看得到 */
  .sh-side{align-self:stretch}
  /* 商品區跟面板一樣寬（.sh 是 flex-start，不設的話會被單排的小分頁撐寬，整個介面往右跑掉） */
  .sh-main{align-self:stretch;width:100%}
  /* 收起時「看試穿」黏在面板頂端，捲到下面的商品也按得到 */
  .sh-side.fold{position:sticky;top:-10px;z-index:5;padding:4px;gap:0;box-shadow:0 4px 10px rgba(0,30,90,.35)}
  .sh-side.fold > :not(.sh-fold){display:none}
  .sh-side.fold .sh-fold{align-self:stretch;padding:6px 10px;font-size:14px;font-weight:900;border-radius:10px;background:linear-gradient(180deg,#ffe86b,#ffae1f);color:#6a3000;border-color:#fff}
  .sh-grid{grid-template-columns:1fr}
  /* 「看試穿」條也黏在頂端：分頁列接在它下面 */
  .sh-side.fold ~ .sh-main .sh-head{top:var(--sh-fold-h,40px)}
  /* 固定區不能太高：小分頁單排橫滑、加成說明只留標題、搜尋和排序縮小 */
  .sh-head .sh-note > span{display:none}
  .sh-head .sh-note{margin-bottom:4px;padding:3px 10px}
  .sh-head .sh-bar{flex-wrap:nowrap;padding:5px 6px}
  .sh-head .sh-subs{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none}
  .sh-head .sh-subs::-webkit-scrollbar{display:none}
  .sh-head .sh-subs .sq-sub{flex:none}
  .sh-head .sh-sort{flex:none;max-width:96px;font-size:11px}
  .sh-top{flex-wrap:nowrap}
  .sh-tabs{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;min-width:0}
  .sh-tabs::-webkit-scrollbar{display:none}
  .sh-search{width:84px;flex:none}
}

/* 主商品＝抽獎區（裝備箱、水球盲盒）；裝扮／外觀的分類列不用固定在頂端 */
.sh-draw{padding:10px 12px;border-radius:14px;background:rgba(255,255,255,.55);border:2px solid #b8dcff}
.sh-draw .lb-box{margin-bottom:8px}
.ward-bar{margin-bottom:8px}
