/* 物品欄：裝備卡片格子、分頁、一鍵分解（2026-10-01.5，js/bag.js） */
/* 照《獵魔村物語》的物品欄：整片深色的面板（淺色主題也是深色；跟冒險者資料 .hs2-sheet 一樣把顏色變數換成深色的，裡面的按鈕、分段、勾選、獵人那一排都跟著變）
   上面三個分頁（選到的是米白色）→ 一鍵分解（深色底、有顏色的字和框）→ 一格一格的卡片：底色照稀有度、深色外框＋一圈亮邊、上面一條狀態字、下面一排像素星星
   手機一排 5 張（約 64px 寬），平板、電腦一排 6～8 張（整頁最寬 980px，卡片大一點、圖示 4 倍） */

.bag-page { width: 100%; max-width: 980px; margin: 0 auto; }

/* ───────── 深色面板 ───────── */
.card.bag-card {
  color-scheme: dark;
  --bg: #120e0d; --surface: #221b19; --surface-2: #1c1614; --surface-3: #2c2320; --field: #1a1412;
  --line: #2e2522; --line-2: #3a302c; --line-3: #52453e; --frame: #3a302c; --text: #f6eee2; --text-2: #d8cbbb; --muted: #b3a493;
  --gold: #e8b54a; --gold-ink: #f0c56a; --gold-soft: rgba(232, 181, 74, 0.14); --accent-soft: rgba(232, 181, 74, 0.10);
  --seal: #e8b54a; --seal-hover: #f5d38a; --seal-dark: #b8892c; --seal-ink: #16120a; --ring: #e8b54a;
  --warn: #f2b83d; --warn-bg: rgba(242, 184, 61, 0.10); --warn-line: rgba(242, 184, 61, 0.45); --danger-text: #ff8a80; --win: #3ecf83; --loss: #f26b66;
  --rar0: #b4aca0; --rar1: #6aa6ff; --rar2: #f6cf3a; --rar3: #ff9446; --rar4: #e8c48a; --rar5: #c47aff;
  --n-on: #3a302c; --n-hover: rgba(255, 255, 255, 0.05);
  /* 像素星星（9×9：7×7 的星＋一圈深色外框）：金色、神話的粉紅金 */
  --star-gold: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9' shape-rendering='crispEdges'%3E%3Cpath fill='%232a1604' d='M4 0h1v1h-1zM3 1h1v1h-1zM5 1h1v1h-1zM1 2h2v1h-2zM6 2h2v1h-2zM0 3h1v1h-1zM8 3h1v1h-1zM1 4h1v1h-1zM7 4h1v1h-1zM2 5h1v1h-1zM6 5h1v1h-1zM1 6h1v1h-1zM4 6h1v1h-1zM7 6h1v1h-1zM0 7h1v1h-1zM3 7h1v1h-1zM5 7h1v1h-1zM8 7h1v1h-1zM1 8h2v1h-2zM6 8h2v1h-2z'/%3E%3Cpath fill='%23fff2a0' d='M4 1h1v1h-1zM3 2h3v1h-3zM1 3h7v1h-7z'/%3E%3Cpath fill='%23ffd23a' d='M2 4h5v1h-5zM3 5h3v1h-3z'/%3E%3Cpath fill='%23e8980e' d='M2 6h2v1h-2zM5 6h2v1h-2zM1 7h2v1h-2zM6 7h2v1h-2z'/%3E%3C/svg%3E");
  --star-pink: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9' shape-rendering='crispEdges'%3E%3Cpath fill='%233a0820' d='M4 0h1v1h-1zM3 1h1v1h-1zM5 1h1v1h-1zM1 2h2v1h-2zM6 2h2v1h-2zM0 3h1v1h-1zM8 3h1v1h-1zM1 4h1v1h-1zM7 4h1v1h-1zM2 5h1v1h-1zM6 5h1v1h-1zM1 6h1v1h-1zM4 6h1v1h-1zM7 6h1v1h-1zM0 7h1v1h-1zM3 7h1v1h-1zM5 7h1v1h-1zM8 7h1v1h-1zM1 8h2v1h-2zM6 8h2v1h-2z'/%3E%3Cpath fill='%23ffe9a0' d='M4 1h1v1h-1zM3 2h3v1h-3zM1 3h7v1h-7z'/%3E%3Cpath fill='%23ff8ad2' d='M2 4h5v1h-5zM3 5h3v1h-3z'/%3E%3Cpath fill='%23e04a9e' d='M2 6h2v1h-2zM5 6h2v1h-2zM1 7h2v1h-2zM6 7h2v1h-2z'/%3E%3C/svg%3E");
  --star-purple: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9' shape-rendering='crispEdges'%3E%3Cpath fill='%2320083a' d='M4 0h1v1h-1zM3 1h1v1h-1zM5 1h1v1h-1zM1 2h2v1h-2zM6 2h2v1h-2zM0 3h1v1h-1zM8 3h1v1h-1zM1 4h1v1h-1zM7 4h1v1h-1zM2 5h1v1h-1zM6 5h1v1h-1zM1 6h1v1h-1zM4 6h1v1h-1zM7 6h1v1h-1zM0 7h1v1h-1zM3 7h1v1h-1zM5 7h1v1h-1zM8 7h1v1h-1zM1 8h2v1h-2zM6 8h2v1h-2z'/%3E%3Cpath fill='%23f4e0ff' d='M4 1h1v1h-1zM3 2h3v1h-3zM1 3h7v1h-7z'/%3E%3Cpath fill='%23c88cff' d='M2 4h5v1h-5zM3 5h3v1h-3z'/%3E%3Cpath fill='%237c3ad8' d='M2 6h2v1h-2zM5 6h2v1h-2zM1 7h2v1h-2zM6 7h2v1h-2z'/%3E%3C/svg%3E");
  --bag-pad: 10px;
  position: relative; padding: 0 var(--bag-pad) 16px; color: var(--text);
  background: radial-gradient(140% 50% at 50% 0%, #2b221e 0%, #1c1614 70%), #1c1614;
  border: 2px solid #0d0907; border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 228, 186, 0.12), 0 12px 26px -18px rgba(0, 0, 0, 0.75);
}
@media (min-width: 700px) { .card.bag-card { --bag-pad: 22px; padding-bottom: 22px; } }
[data-theme="night"] .card.bag-card { background: radial-gradient(140% 50% at 50% 0%, #241c19 0%, #161110 70%), #161110; border-color: #050302; }
.bag-card .btn:hover { background: var(--surface-3); border-color: var(--line-3); }
.bag-card .btn-primary:hover { background: var(--seal-hover); border-color: var(--seal-hover); }
.bag-card .link:hover { color: #ffe08a; }
.bag-card input[type="checkbox"] { accent-color: #e8b54a; width: 16px; height: 16px; margin: 0; }
.bag-card .seg { background: #120d0b; border-color: #3a302c; }
.bag-card .seg-btn { color: #b3a493; }
.bag-card .seg-btn:hover { color: #f6eee2; }
.bag-card .seg-btn.on { background: linear-gradient(#4c3e33, #3a2e25); color: #ffe6a8; font-weight: 800; box-shadow: inset 0 0 0 1px #8a6a3a; }

/* ───────── 分頁 ───────── */
.bag-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin: 0 calc(-1 * var(--bag-pad)) 14px; padding: 8px 8px 0;
  border-radius: 10px 10px 0 0; background: linear-gradient(#2e2522, #211a17); border-bottom: 2px solid #d8ccb6; }
.bag-tab { position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; height: 44px; padding: 0 6px;
  border: 1px solid #4a3c33; border-bottom: 0; border-radius: 8px 8px 0 0; background: linear-gradient(#3c322d, #2a2320); color: #b3a493;
  font: 800 15px/1 var(--font); letter-spacing: 0.08em; white-space: nowrap; cursor: pointer; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07); }
.bag-tab:hover { color: #f6eee2; }
.bag-tab.on { background: linear-gradient(#fdf7e8, #d9cdb6); color: #3a2a20; border-color: #f3ead9; box-shadow: inset 0 1px 0 #fff; }
/* 選到的分頁：上面兩個角各一個小小的金色雕花角（遊戲裡的分頁框） */
.bag-tab.on::before, .bag-tab.on::after { content: ''; position: absolute; top: 4px; width: 8px; height: 8px; border-top: 2px solid #b8862a; pointer-events: none; }
.bag-tab.on::before { left: 4px; border-left: 2px solid #b8862a; border-top-left-radius: 4px; }
.bag-tab.on::after { right: 4px; border-right: 2px solid #b8862a; border-top-right-radius: 4px; }
.bag-tab:focus-visible { outline: 2px solid #ffe066; outline-offset: -5px; }
.bag-tab.on:focus-visible { outline-color: #b8862a; }
.bag-tab-t { overflow: hidden; text-overflow: ellipsis; }
.bag-tab-ico { margin-right: 2px; font-size: 16px; letter-spacing: 0; }
@media (min-width: 560px) { .bag-tabs { gap: 8px; padding: 10px 14px 0; } .bag-tab { height: 46px; font-size: 16px; } }

.bag-panel { display: grid; gap: 12px; min-width: 0; }
.bag-sec { display: grid; gap: 8px; min-width: 0; }
.bag-sec + .bag-sec { padding-top: 12px; border-top: 1px dashed #3a302c; }
.bag-h { display: inline-flex; align-items: center; gap: 8px; margin: 0; font: 900 15px/1.3 var(--font); color: #f6e6c4; letter-spacing: 0.04em; }
.bag-h-row { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 10px; flex-wrap: wrap; }
.bag-hint { color: #f6d78a; }

/* 看誰的物品欄（倉庫＋每位獵人） */
.bag-who-card { display: grid; gap: 8px; min-width: 0; padding-bottom: 12px; border-bottom: 1px dashed #3a302c; }
.bag-who-card p { margin: 0; }
.bag-who-card .bag-who { padding-bottom: 4px; }
.bag-who-card .hunter-panel { margin: 0; }
.bag-who-card .hd-equip-head { flex-wrap: wrap; }
.bag-hd-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-left: auto; }
.bag-card .bag-strip { color: #ffd0a0; border-color: #6a4a34; }

/* 物品欄的標題列、篩選 */
.bag-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.bag-count { padding: 1px 9px; border-radius: 999px; background: #120d0b; border: 1px solid #4a3c34; font: 800 13px/1.5 var(--font); color: #f6eee2; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.bag-count.full { color: #ff8a7a; border-color: #a83a2a; }
.bag-card .bag-filter { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); width: 100%; }
.bag-card .bag-filter .seg-btn { padding: 7px 2px; font-size: 13px; }
@media (min-width: 560px) { .bag-card .bag-filter { display: inline-flex; width: auto; } .bag-card .bag-filter .seg-btn { padding: 6px 11px; } }
.bag-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; }
.bag-opts label { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--text-2); cursor: pointer; }
.bag-opts .bag-fit { display: inline-flex; margin: 0; }
.bag-fit-hint { margin: -6px 0 0; }

/* 一鍵分解（照遊戲：深色底、有顏色的字和框） */
.bag-salvage { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1.3fr); align-items: center; gap: 5px; padding: 8px 0 0; border-top: 1px solid #2e2522; }
.bs-t { margin-right: 2px; font: 900 14px/1 var(--font); color: #ece0cc; letter-spacing: 0.06em; text-shadow: 0 1px 0 #000; white-space: nowrap; }
.bs-chip { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; height: 32px; padding: 0 5px; border-radius: 4px; cursor: pointer;
  background: linear-gradient(#211a16, #120e0c); border: 1.5px solid var(--bs); color: var(--bs-t); font: 900 12.5px/1 var(--font); white-space: nowrap;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.7), 0 0 0 1px #070504; }
.bs-chip .bs-n { min-width: 20px; padding: 3px 4px; border-radius: 999px; background: color-mix(in srgb, var(--bs) 45%, #000); color: #fff; font-size: 11px; text-align: center; font-variant-numeric: tabular-nums; }
@media (min-width: 560px) {
  .bag-salvage { display: flex; justify-content: flex-end; gap: 6px; }
  .bs-t { margin-right: 4px; font-size: 15px; letter-spacing: 0.14em; }
  .bs-chip { gap: 6px; padding: 0 8px 0 10px; font-size: 13px; letter-spacing: 0.04em; }
  .bs-chip .bs-n { min-width: 22px; padding: 3px 5px; letter-spacing: 0; }
}
.bs-0 { --bs: #7a7064; --bs-t: #e0d8cc; }
.bs-1 { --bs: #2f66c8; --bs-t: #7cb6ff; }
.bs-2 { --bs: #a07814; --bs-t: #ffd34a; }
@media (max-width: 340px) { .bag-salvage { gap: 4px; } .bs-t { font-size: 13px; letter-spacing: 0; } .bs-chip { gap: 3px; padding: 0 3px; font-size: 12px; } .bs-chip .bs-n { min-width: 18px; padding: 2px 3px; } }
.bs-chip:hover:not(:disabled) { filter: brightness(1.3); }
.bs-chip:disabled { opacity: 0.38; cursor: default; }
.bs-chip:focus-visible { outline: 2px solid #ffe066; outline-offset: 2px; }

/* ───────── 卡片（裝備、素材、結晶、英雄卡共用） ───────── */
.bag-card .bag-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
@media (max-width: 340px) { .bag-card .bag-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 560px) { .bag-card .bag-grid { grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 10px; } }
.bag-card .bk {
  --c1: #a39887; --c2: #5a5248; --c3: #221d19; --hi: rgba(255, 238, 210, 0.3); --doll-ol: #140c08;
  position: relative; isolation: isolate; display: grid; grid-template-rows: minmax(0, 1fr) auto; justify-items: center; align-items: center;
  min-width: 0; aspect-ratio: 0.82; padding: 4px 2px 5px; overflow: hidden;
  border: 2px solid #0d0806; border-radius: 8px;
  background: radial-gradient(ellipse 80% 62% at 50% 42%, var(--c1) 0%, var(--c2) 56%, var(--c3) 100%);
  box-shadow: inset 0 0 0 1px var(--hi), inset 0 -14px 16px -12px rgba(0, 0, 0, 0.65), 0 2px 0 rgba(0, 0, 0, 0.4);
  color: #fff; font: inherit; line-height: 1.1; text-align: center; text-decoration: none;
}
/* 底色照稀有度：普通灰褐、魔法藍、稀有金黃、傳奇橘、獨特淡金（一道斜的亮光）、神話紫色（像暗黑 4：一道慢慢掃過去的流光；2026-10-01.7 從深紅粉換成紫色） */
.bag-card .rar-0 { --c1: #a39887; --c2: #5a5248; --c3: #221d19; --hi: rgba(255, 238, 210, 0.3); }
.bag-card .rar-1 { --c1: #4f8fe6; --c2: #22437a; --c3: #0d1529; --hi: rgba(170, 210, 255, 0.4); }
.bag-card .rar-2 { --c1: #e8b83c; --c2: #7c5810; --c3: #271a05; --hi: rgba(255, 230, 150, 0.45); }
.bag-card .rar-3 { --c1: #f58c36; --c2: #973c12; --c3: #2e1005; --hi: rgba(255, 200, 150, 0.45); }
.bag-card .rar-4 { --c1: #efd7a4; --c2: #8f6f45; --c3: #2a1f14; --hi: rgba(255, 244, 210, 0.55); }
.bag-card .rar-5 { --c1: #b86cff; --c2: #4e1a92; --c3: #17072e; --hi: rgba(226, 196, 255, 0.6); }
.bag-card .bk.rar-4 { background: linear-gradient(118deg, transparent 30%, rgba(255, 252, 236, 0.28) 44%, rgba(255, 252, 236, 0.06) 52%, transparent 60%),
  radial-gradient(ellipse 80% 62% at 50% 42%, var(--c1) 0%, var(--c2) 56%, var(--c3) 100%); }
.bag-card .bk.rar-5::after { content: ''; position: absolute; inset: -2px; z-index: 2; pointer-events: none;
  background: linear-gradient(105deg, transparent 36%, rgba(246, 232, 255, 0.6) 47%, rgba(200, 150, 255, 0.45) 53%, transparent 64%);
  transform: translateX(-130%); animation: bk-sweep 4.5s ease-in-out infinite; }
.bag-card .bk.rar-5:nth-child(2n)::after { animation-delay: -1.5s; }
.bag-card .bk.rar-5:nth-child(3n)::after { animation-delay: -3s; }
@keyframes bk-sweep { 0%, 50% { transform: translateX(-130%); } 85%, 100% { transform: translateX(130%); } }

/* 裝備卡片 */
.bag-card .bag-tile { cursor: pointer; transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease; }
@media (hover: hover) {
  .bag-card .bag-tile:hover { transform: translateY(-2px); filter: brightness(1.12); border-color: color-mix(in srgb, var(--c1) 55%, #0d0806);
    box-shadow: inset 0 0 0 1px var(--hi), 0 0 0 1px color-mix(in srgb, var(--c1) 80%, transparent), 0 6px 14px -4px color-mix(in srgb, var(--c1) 75%, transparent); }
}
.bag-card .bag-tile:active { transform: translateY(0); }
.bag-card .bag-tile:focus-visible { outline: 2px solid #ffe066; outline-offset: 2px; transform: translateY(-2px);
  box-shadow: inset 0 0 0 1px var(--hi), 0 6px 14px -4px color-mix(in srgb, var(--c1) 75%, transparent); }
.bag-card .bag-tile .gear-ico { grid-row: 1; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.45)); }
.bag-card .bag-tile .gear-ico svg { width: 48px; height: 48px; }
.bag-card .bag-tile.worn { padding-top: 13px; }
/* 上面一條字（像遊戲的「無法陳列」）：穿著中＋誰 */
.bag-card .bt-who { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: block; max-width: none; height: 15px; padding: 0 1px;
  background: linear-gradient(rgba(12, 4, 2, 0.88), rgba(12, 4, 2, 0.62)); border-bottom: 1px solid rgba(255, 90, 70, 0.35);
  font: 800 9px/15px var(--font); letter-spacing: -0.4px; color: #fff; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bag-card .bt-who b { margin-right: 1px; color: #ff5b4a; font-weight: 900; }
/* 角落：左上強化 +N、附魔；右上鎖頭；右下物品強度 */
.bag-card .bt-tl { position: absolute; left: 3px; top: 3px; z-index: 3; display: grid; justify-items: start; gap: 2px; }
.bag-card .bag-tile.worn .bt-tl, .bag-card .bag-tile.worn .bt-lock { top: 18px; }
.bag-card .bt-upg { padding: 0 3px; border-radius: 4px; background: rgba(16, 9, 6, 0.86); border: 1px solid #c9a24a; color: #ffe38a; font: 900 10px/13px var(--font); }
.bag-card .bt-en { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--tw, #c47aff);
  background: color-mix(in srgb, var(--tw, #c47aff) 30%, #120a08); font-size: 9px; line-height: 1; }
.bag-card .bt-lock { position: absolute; top: 3px; right: 3px; z-index: 3; font-size: 11px; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.9)); }
.bag-card .bt-ip { position: absolute; right: 4px; bottom: 16px; z-index: 3; font: 800 10px/1 var(--font); color: #fff; font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 0 #000, 1px 0 0 #000, -1px 0 0 #000, 0 -1px 0 #000, 0 0 3px #000; }
/* 下面一排像素星星：稀有度＋1 顆（普通 1 顆～神話 6 顆） */
.bag-card .bt-stars { grid-row: 2; display: block; width: calc(var(--n, 1) * 9px); height: 9px; margin: 1px auto 0; background: var(--star-gold) 0 0 / 9px 9px repeat-x; }
.bag-card .rar-5 .bt-stars { background-image: var(--star-purple); filter: drop-shadow(0 0 2px rgba(200, 140, 255, 0.95)); }
/* 選了獵人：最下面一條戰力變化 */
.bag-card .bag-grid.with-delta .bk { aspect-ratio: 0.7; grid-template-rows: minmax(0, 1fr) auto auto; padding-bottom: 0; }
.bag-card .bag-grid.with-delta .bt-ip { bottom: 35px; }
.bag-card .bt-delta { grid-row: 3; align-self: end; width: calc(100% + 4px); margin: 4px -2px 0; padding: 2px 0 3px; background: rgba(8, 4, 2, 0.75); border-top: 1px solid rgba(255, 255, 255, 0.08);
  font: 900 11px/1.2 var(--font); color: #d8cbbb; font-variant-numeric: tabular-nums; }
.bag-card .bt-delta.up { color: #6ee08a; }
.bag-card .bt-delta.down { color: #ff7a6a; }
@media (min-width: 560px) {
  .bag-card .bag-tile .gear-ico svg { width: 64px; height: 64px; }
  .bag-card .bag-tile.worn { padding-top: 15px; }
  .bag-card .bt-who { height: 17px; padding: 0 3px; font-size: 11px; line-height: 17px; letter-spacing: 0; }
  .bag-card .bt-who b { margin-right: 3px; }
  .bag-card .bag-tile.worn .bt-tl, .bag-card .bag-tile.worn .bt-lock { top: 20px; }
  .bag-card .bt-tl { left: 4px; top: 4px; gap: 3px; }
  .bag-card .bt-upg { padding: 0 4px; font-size: 12px; line-height: 16px; }
  .bag-card .bt-en { width: 20px; height: 20px; font-size: 11px; }
  .bag-card .bt-lock { top: 5px; right: 5px; font-size: 14px; }
  .bag-card .bt-ip { bottom: 21px; font-size: 11.5px; }
  .bag-card .bag-grid.with-delta .bt-ip { bottom: 41px; }
  .bag-card .bt-stars { width: calc(var(--n, 1) * 13.5px); height: 13.5px; background-size: 13.5px 13.5px; }
  .bag-card .bt-delta { font-size: 12px; }
}
.bag-none { margin: 0; padding: 18px 8px; border-radius: 8px; border: 1px dashed #3a302c; text-align: center; color: var(--muted); }

/* 稀有度說明（顏色＋幾顆星） */
.bag-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; color: var(--muted); }
.bl-i { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.bl-i small { font-size: 11px; color: #ffd23a; }
.bl-sw { display: inline-block; width: 12px; height: 14px; border-radius: 3px; border: 1px solid #0d0806;
  background: radial-gradient(ellipse 80% 62% at 50% 42%, var(--c1) 0%, var(--c2) 60%, var(--c3) 100%); box-shadow: inset 0 0 0 1px var(--hi); }
.bag-auto { display: grid; gap: 6px; padding-top: 12px; border-top: 1px dashed #3a302c; }
.bag-auto p { margin: 0; }

/* ───────── 素材、元素結晶、英雄卡 ───────── */
.bk-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px 6px; }
@media (max-width: 340px) { .bk-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 560px) { .bk-grid { grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 12px 10px; } }
.bk-cell { display: grid; align-content: start; justify-items: center; gap: 4px; min-width: 0; }
.bk-cell > .bk { width: 100%; }
.bk-cap { max-width: 100%; font-size: 10.5px; line-height: 1.25; color: var(--muted); text-align: center; }
.bag-card .bk-name { position: absolute; top: 0; left: 0; right: 0; z-index: 3; height: 15px; padding: 0 2px; background: linear-gradient(rgba(12, 4, 2, 0.85), rgba(12, 4, 2, 0.55));
  font: 800 9.5px/15px var(--font); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bag-card .bk .bk-ico { grid-row: 1; display: grid; place-items: center; padding-top: 11px; line-height: 0; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.45)); }
.bag-card .bk .bk-ico svg { display: block; }
.bag-card .bk .bk-sq svg { width: 48px; height: 48px; }
.bag-card .bk.bag-mat, .bag-card .bk.bag-crystal, .bag-card .bk.bag-book { aspect-ratio: 0.74; }
.bag-card .bk-n { grid-row: 2; font: 900 13px/1 var(--font); color: #fff; font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 0 #000, 1px 0 0 #000, -1px 0 0 #000, 0 -1px 0 #000, 0 0 4px #000; }
.bk-cell.dim .bk { filter: grayscale(0.9) brightness(0.55); }
.bk-cell.dim .bk-cap { opacity: 0.6; }
@media (min-width: 560px) {
  .bag-card .bk-name { height: 17px; font-size: 11px; line-height: 17px; }
  .bag-card .bk .bk-ico { padding-top: 13px; }
  .bag-card .bk .bk-sq svg { width: 64px; height: 64px; }
  .bag-card .bk-n { font-size: 15px; }
  .bk-cap { font-size: 12px; }
}
/* 技能書（紅皮）、魔法書（藍皮）：卡片底色；第 3 層多一圈金光 */
.bb-skill, .bag-card .bb-skill { --c1: #e6844c; --c2: #7c2a16; --c3: #240b05; --hi: rgba(255, 210, 170, 0.45); }
.bb-magic, .bag-card .bb-magic { --c1: #7a86ff; --c2: #2e2c86; --c3: #0b0a28; --hi: rgba(200, 210, 255, 0.45); }
.bag-card .bag-book { cursor: pointer; transition: transform 0.12s ease, filter 0.12s ease; }
.bag-card .bag-book.bt3 { box-shadow: inset 0 0 0 1px var(--hi), inset 0 -14px 16px -12px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 216, 74, 0.6), 0 0 8px rgba(255, 216, 74, 0.35), 0 2px 0 rgba(0, 0, 0, 0.4); }
@media (hover: hover) { .bag-card .bag-book:hover { transform: translateY(-2px); filter: brightness(1.12); } }
.bag-card .bag-book:focus-visible { outline: 2px solid #ffe066; outline-offset: 2px; }
.bag-card .bk-tier { position: absolute; left: 3px; top: 18px; z-index: 3; min-width: 16px; padding: 0 3px; border-radius: 4px; background: rgba(16, 9, 6, 0.86); border: 1px solid #c9a24a;
  color: #ffe38a; font: 900 10px/13px var(--serif); text-align: center; }
.bag-card .bk-can { position: absolute; right: 3px; top: 18px; z-index: 3; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: #2e9d62; border: 1px solid #b8ffd0;
  color: #fff; font: 900 10px/14px var(--font); text-align: center; }
.bag-bookrow { display: grid; gap: 6px; }
.bag-booklabel { font-weight: 800; color: var(--text-2); }
.bag-src { margin: 0; }
@media (min-width: 560px) {
  .bag-card .bk-tier { top: 21px; font-size: 11px; line-height: 15px; }
  .bag-card .bk-can { top: 21px; height: 18px; font-size: 11px; line-height: 16px; }
}
/* 點一本書的面板（在物品欄外面，照目前的主題） */
.book-detail { display: grid; gap: 10px; }
.book-detail p { margin: 0; }
.bd-head { display: flex; align-items: center; gap: 12px; }
.bd-ico { flex: none; display: grid; place-items: center; width: 72px; height: 72px; border-radius: 10px; border: 2px solid #0d0806; --doll-ol: #140c08;
  background: radial-gradient(ellipse 80% 62% at 50% 42%, var(--c1) 0%, var(--c2) 56%, var(--c3) 100%); box-shadow: inset 0 0 0 1px var(--hi); }
.bd-ico .bk-ico { line-height: 0; }
.bd-ico svg { display: block; width: 48px; height: 48px; }
.bd-info { display: grid; gap: 2px; min-width: 0; }
.bd-name { font-size: 18px; }
.bd-desc { padding: 8px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line-2); }
.bd-list { display: grid; gap: 6px; }
.bd-go { display: block; color: inherit; text-decoration: none; border-radius: 12px; }
.bd-go .hero-chip { width: 100%; }
.bd-go:hover .hero-chip { border-color: var(--gold); }
.bd-go:focus-visible { outline: 2px solid var(--gold-ink); outline-offset: 2px; }
.bd-tag { margin-left: auto; padding-left: 6px; color: #2e9d62; font-weight: 800; white-space: nowrap; }
[data-theme="night"] .bd-tag { color: #5fd07a; }
.bd-no ul { margin: 6px 0 0; padding-left: 18px; list-style: disc; display: grid; gap: 3px; }
/* 元素結晶：底色照元素 */
.bag-card .cry-fire { --c1: #f0763c; --c2: #872a10; --c3: #2a0b04; --hi: rgba(255, 200, 160, 0.42); }
.bag-card .cry-cold { --c1: #4cb6ea; --c2: #1a5888; --c3: #08182a; --hi: rgba(190, 240, 255, 0.42); }
.bag-card .cry-poison { --c1: #7cc43c; --c2: #2c661a; --c3: #0c1e07; --hi: rgba(220, 255, 180, 0.4); }
.bag-card .cry-shadow { --c1: #9a5ae2; --c2: #43207a; --c3: #140926; --hi: rgba(225, 200, 255, 0.42); }
.bag-card .cry-lightning { --c1: #f2c83c; --c2: #85660e; --c3: #281d04; --hi: rgba(255, 240, 170, 0.45); }
/* 英雄卡：金粉色的大一點的卡、站著的英雄 */
.bag-card .bk-heroes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 560px) { .bag-card .bk-heroes { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); } }
@media (min-width: 900px) { .bag-card .bk-heroes { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 12px 8px; } }
.bag-card .bk.bag-hero { --c1: #f7c75e; --c2: #8c2a5c; --c3: #22071a; --hi: rgba(255, 220, 170, 0.55); aspect-ratio: 0.62; }
.bag-card .bag-hero .bk-pic { padding-top: 14px; }
.bag-card .bag-hero .bk-pic svg { max-width: 100%; }
.bag-card .bk-own { position: absolute; right: 3px; top: 18px; z-index: 3; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center;
  background: #2e9d62; border: 1px solid #b8ffd0; color: #fff; font: 900 10px/1 var(--font); }
.bk-cell.dim .bag-hero .hero-doll { filter: brightness(0.3) saturate(0); }
/* 其他：英魂、坐騎裝備、恐龍蛋（一列一個，點了去那一頁） */
.bag-xlist { display: grid; gap: 8px; }
@media (min-width: 760px) { .bag-xlist { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.bag-xrow { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 10px 8px 8px; border-radius: 10px; border: 1px solid #3a302c;
  background: rgba(255, 255, 255, 0.03); color: var(--text); text-decoration: none; }
.bag-xrow:hover { border-color: var(--gold); background: rgba(232, 181, 74, 0.07); }
.bag-xrow:focus-visible { outline: 2px solid #ffe066; outline-offset: 2px; }
.bag-card .bag-xrow .bx-card { flex: none; width: 56px; aspect-ratio: 1; padding: 0; grid-template-rows: 1fr; place-items: center; }
.bag-card .bag-xrow .bx-card .bk-ico { padding: 0; }
.bag-card .x-soul .bx-card { --c1: #b27aff; --c2: #4c1f86; --c3: #170828; --hi: rgba(225, 200, 255, 0.45); }
.bag-card .x-mgear .bx-card { --c1: #d9a066; --c2: #6e4224; --c3: #22140a; --hi: rgba(255, 220, 180, 0.4); }
.bag-card .x-egg .bx-card { --c1: #8ad08a; --c2: #2f6a3a; --c3: #0c2010; --hi: rgba(210, 255, 210, 0.4); }
.bx-soul .soul-ico { width: 30px; height: 30px; box-shadow: 0 0 12px rgba(196, 122, 255, 0.9); }
.bag-xrow.dim .bx-card { filter: grayscale(0.85) brightness(0.6); }
.bx-main { flex: 1; display: grid; gap: 2px; min-width: 0; }
.bx-name { font: 900 15px/1.3 var(--font); color: #f6e6c4; }
.bx-n { color: #ffd36a; font-variant-numeric: tabular-nums; }
.bag-xrow.dim .bx-n { color: var(--muted); }
.bx-cap { color: var(--muted); line-height: 1.45; }
.bx-go { color: var(--gold-ink); font-weight: 800; }
.bag-xrow:hover .bx-go { text-decoration: underline; }
.bag-go { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.bag-rules { display: grid; gap: 6px; margin: 0; padding: 12px 0 0 18px; list-style: disc; color: var(--text-2); border-top: 1px dashed #3a302c; line-height: 1.6; }
.bag-rules b { color: #f6e6c4; }

@media (prefers-reduced-motion: reduce) {
  .bag-card .bk.rar-5::after { animation: none; transform: none; opacity: 0.4; }
  .bag-card .bag-tile { transition: none; }
  .bag-card .bag-tile:hover, .bag-card .bag-tile:focus-visible { transform: none; }
}

/* ───────── 專武（2026-10-01.6）：深紅＋金色的卡、左下一個「專」字的印、金色的星星（js/bag.js 的 .bag-tile.excl） ───────── */
.bag-card .rar-5.excl { --c1: #ff6a5a; --c2: #8a0f26; --c3: #2a0208; --hi: rgba(255, 214, 120, 0.7); }
.bag-card .bk.bag-tile.excl { border-color: #2a0a04;
  box-shadow: inset 0 0 0 1px var(--hi), inset 0 0 0 2px rgba(138, 15, 38, 0.55), 0 0 0 1px #d89a2a, 0 2px 0 rgba(0, 0, 0, 0.4); }
.bag-card .bk.excl::after { background: linear-gradient(105deg, transparent 36%, rgba(255, 244, 214, 0.6) 47%, rgba(255, 196, 80, 0.5) 53%, transparent 64%); }
.bag-card .bt-excl { position: absolute; left: 3px; bottom: 15px; z-index: 3; display: grid; place-items: center; width: 15px; height: 15px; border-radius: 3px;
  background: linear-gradient(135deg, #c8283c, #7a0c22); border: 1px solid #f2c250; color: #fff2c0; font: 900 10px/1 var(--font); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5); }
.bag-card .bag-grid.with-delta .bt-excl { bottom: 34px; }
.bag-card .excl .bt-stars { background-image: var(--star-gold); filter: drop-shadow(0 0 2px rgba(255, 90, 80, 0.9)); }
.bag-card .bl-i.excl small { color: #ff8a7a; font-weight: 900; }
.item-salv { white-space: pre-line; }
@media (min-width: 560px) {
  .bag-card .bt-excl { left: 4px; bottom: 20px; width: 19px; height: 19px; font-size: 12px; }
  .bag-card .bag-grid.with-delta .bt-excl { bottom: 40px; }
}
.bag-links { display: inline-flex; flex-wrap: wrap; gap: 2px 12px; }

/* ───────── 神話（2026-10-01.7）：紫色、像暗黑 4 的神話裝備 ─────────
   物品欄的卡片（.bag-tile.myth）：紫色底＋流光（上面的 .rar-5）、一圈紫色亮邊、左下一個 ◆；舊資料多穿的（沒有作用）＝暗下來＋一條字
   其他頁也用得到（這個檔每一頁都會載入）：裝備卡 .gear-card.myth、小圖 .gear-ico.myth、身上那一格 .equip-slot.myth、換裝備清單 .gear-pick li.myth、
   「神話」徽章 .myth-badge、「限：亞馬遜、僧侶」.xg-cls、「每位冒險者限穿 1 件」.xg-limit、「沒有作用」.xg-idle、獎勵裡的 .myth-over */
:root { --myth: #9a4ad8; --myth-hi: #c98cff; --myth-ink: #6a24b8; --myth-bg: rgba(154, 74, 216, 0.1); }
:root[data-theme="night"] { --myth: #c080ff; --myth-hi: #e2c4ff; --myth-ink: #d6aaff; --myth-bg: rgba(192, 128, 255, 0.12); }
.bag-card .bk.bag-tile.myth { border-color: #12051f;
  box-shadow: inset 0 0 0 1px var(--hi), inset 0 0 0 2px rgba(110, 40, 190, 0.5), 0 0 0 1px #a868ff, 0 0 10px -2px rgba(168, 104, 255, 0.75), 0 2px 0 rgba(0, 0, 0, 0.4); }
.bag-card .bt-myth { position: absolute; left: 3px; bottom: 15px; z-index: 3; display: grid; place-items: center; width: 15px; height: 15px; border-radius: 3px;
  background: linear-gradient(135deg, #a45cff, #4e1a92); border: 1px solid #e6ccff; color: #fff; font: 900 9px/1 var(--font); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5); }
.bag-card .bag-grid.with-delta .bt-myth { bottom: 34px; }
.bag-card .bag-tile.myth.idle .gear-ico { filter: grayscale(0.85) brightness(0.55) drop-shadow(0 2px 0 rgba(0, 0, 0, 0.45)); }
.bag-card .bt-idle { position: absolute; left: 0; right: 0; top: 50%; z-index: 4; transform: translateY(-50%); padding: 2px 0; background: rgba(20, 6, 30, 0.86);
  border-top: 1px solid #a868ff; border-bottom: 1px solid #a868ff; color: #f0dcff; font: 900 9.5px/1.2 var(--font); white-space: nowrap; }
.bag-card .bag-count.bag-myth { color: #e2c4ff; border-color: #6a3aa8; background: #1a0d26; }
.bag-card .bag-count.bag-myth.full { color: #ff9ad8; border-color: #b04a9a; }
.bag-card .bl-i.rar-5 small { color: #d6a8ff; }
.bag-card .bl-i.rar-5.excl small { color: #ff8a7a; }
.bag-myth-rule { margin: 0; }
@media (min-width: 560px) {
  .bag-card .bt-myth { left: 4px; bottom: 20px; width: 19px; height: 19px; font-size: 11px; }
  .bag-card .bag-grid.with-delta .bt-myth { bottom: 40px; }
  .bag-card .bt-idle { font-size: 11px; }
}
/* 小圖：紫色的框，一道流光掃過 */
.gear-ico.rar-5.myth { position: relative; overflow: hidden; border-color: var(--myth); background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--myth) 30%, var(--field)), color-mix(in srgb, var(--myth) 12%, var(--field)));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--myth-hi) 50%, transparent), 0 0 10px color-mix(in srgb, var(--myth) 70%, transparent); }
.gear-ico.myth::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 245, 255, 0.55) 48%, transparent 62%); transform: translateX(-120%); animation: myth-sweep 3.6s ease-in-out infinite; }
@keyframes myth-sweep { 0%, 45% { transform: translateX(-120%); } 80%, 100% { transform: translateX(120%); } }
/* 裝備卡：暗黑 4 那種紫色的框（外面一圈亮紫、裡面一條細金線），標題字紫色 */
.gear-card.myth { position: relative; overflow: hidden; border-color: var(--myth);
  background: linear-gradient(170deg, color-mix(in srgb, var(--myth) 16%, var(--field)), var(--field) 55%, color-mix(in srgb, var(--myth) 10%, var(--field)));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #f2c250 35%, transparent), 0 0 0 1px color-mix(in srgb, var(--myth-hi) 45%, transparent), 0 0 14px -4px var(--myth); }
.gear-card.myth::before { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(115deg, transparent 30%, rgba(220, 180, 255, 0.22) 46%, rgba(255, 255, 255, 0.12) 50%, transparent 66%); transform: translateX(-110%); animation: myth-sweep 5s ease-in-out infinite; }
.gear-card.myth .rar-text { color: var(--myth-ink); text-shadow: 0 0 10px color-mix(in srgb, var(--myth) 45%, transparent); }
.gear-card.myth .xg-fx { background: var(--myth-bg); border: 1px solid color-mix(in srgb, var(--myth) 35%, transparent); }
.gear-card.myth .xg-fx b { color: var(--myth-ink); }
.xg-myth { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.myth-badge { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px 1px 5px; border-radius: 999px; line-height: 1.5;
  background: linear-gradient(135deg, #a45cff, #5a1fa8); border: 1px solid #e6ccff; color: #fff; font-size: 11.5px; font-weight: 900; letter-spacing: 0.06em;
  box-shadow: 0 0 8px rgba(164, 92, 255, 0.55); }
.myth-badge i { font-style: normal; font-size: 9px; color: #f6e8ff; }
.xg-cls { color: var(--myth-ink); font-weight: 900; }
.xg-cls.any { color: var(--muted); font-weight: 700; }
.xg-limit { margin: 0; padding: 4px 8px; border-radius: 8px; border: 1px dashed color-mix(in srgb, var(--myth) 55%, transparent); color: var(--myth-ink); font-weight: 700; }
.xg-idle { margin: 0; padding: 6px 8px; border-radius: 8px; background: rgba(120, 120, 120, 0.12); border: 1px solid color-mix(in srgb, var(--danger-text, #d0453a) 45%, transparent); line-height: 1.5; }
.xg-idle b { color: var(--danger-text, #d0453a); }
.gear-card.myth.idle .xg-lines, .gear-card.myth.idle .xg-fx { opacity: 0.5; filter: grayscale(0.6); }
/* 身上那一格、換裝備的清單 */
.equip-slot.myth { position: relative; border-color: var(--myth); background: linear-gradient(170deg, var(--myth-bg), var(--field)); box-shadow: 0 0 10px -3px var(--myth); }
.equip-slot .es-myth { position: absolute; top: 3px; left: 3px; z-index: 1; padding: 0 4px; border-radius: 3px; background: linear-gradient(135deg, #a45cff, #5a1fa8); border: 1px solid #e6ccff; color: #fff; font-size: 10px; font-weight: 900; line-height: 1.5; }
.equip-slot.myth.idle { opacity: 0.7; }
.equip-slot.myth.idle .es-myth { background: #6a6a6a; }
.gear-pick li.myth { border-color: color-mix(in srgb, var(--myth) 60%, var(--line-2)); background: linear-gradient(100deg, var(--myth-bg), var(--field) 60%); }
.myth-over { margin: 6px 0 0; padding: 6px 8px; border-radius: 8px; background: var(--myth-bg); border: 1px solid color-mix(in srgb, var(--myth) 40%, transparent); line-height: 1.5; }
.myth-over b { color: var(--myth-ink); }
@media (prefers-reduced-motion: reduce) {
  .gear-ico.myth::after, .gear-card.myth::before { animation: none; opacity: 0; }
}

/* ───────── 單手、雙手、腰帶（2026-10-02.1）─────────
   物品卡名字旁邊「單手／雙手」.hands-badge（雙手＝金色）、雙手武器的說明 .xg-hands
   雙手武器配了盾⋯（舊資料）＝「沒有作用」：裝備卡 .gear-card.idle、身上那一格 .equip-slot.idle .es-idle、物品欄的卡片 .bag-tile.idle（神話多穿的照上面紫色的）
   換裝備的面板：副手那格寫規則 .slot-hands、清單裡「會脫下來的副手」.gp-off、物品欄「給 誰」那一塊 .for-off */
.xg-nrow { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-width: 0; }
.hands-badge { display: inline-flex; align-items: center; padding: 0 6px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--field); color: var(--muted);
  font-size: 11px; font-weight: 900; line-height: 1.6; white-space: nowrap; vertical-align: middle; letter-spacing: 0.04em; }
.hands-badge.two { border-color: #c8862a; background: linear-gradient(135deg, #ffe3a8, #f2b44a); color: #5a3208; }
:root[data-theme="night"] .hands-badge.two { border-color: #f2b44a; background: linear-gradient(135deg, #5a3a10, #3a2208); color: #ffd68a; }
.gp-main .hands-badge { margin: 0 2px 0 6px; }
.xg-hands { margin: 0; padding: 4px 8px; border-radius: 8px; border: 1px dashed color-mix(in srgb, #d08a2a 60%, transparent); line-height: 1.5; }
.xg-hands b { color: #a8601a; }
:root[data-theme="night"] .xg-hands b { color: #ffc46a; }
.gear-card.idle:not(.myth) .xg-lines { opacity: 0.5; filter: grayscale(0.6); }
.equip-slot.idle:not(.myth) { position: relative; opacity: 0.75; }
.equip-slot.idle:not(.myth) .gear-ico { filter: grayscale(0.9); }
.equip-slot .es-idle { position: absolute; top: 3px; left: 3px; z-index: 1; padding: 0 4px; border-radius: 3px; background: #7a2a22; border: 1px solid #ff8a80; color: #fff; font-size: 10px; font-weight: 900; line-height: 1.5; }
.bag-card .bag-tile.idle:not(.myth) .gear-ico { filter: grayscale(0.85) brightness(0.55) drop-shadow(0 2px 0 rgba(0, 0, 0, 0.45)); }
.bag-card .bag-tile.idle:not(.myth) .bt-idle { background: rgba(40, 10, 8, 0.88); border-color: #ff8a80; color: #ffe0dc; }
.slot-hands, .for-off { margin: 0; padding: 6px 8px; border-radius: 8px; background: color-mix(in srgb, #f2b44a 12%, var(--field)); border: 1px solid color-mix(in srgb, #d08a2a 50%, transparent); line-height: 1.5; }
.for-off { margin-top: 6px; }
.slot-hands b { color: #a8601a; }
:root[data-theme="night"] .slot-hands b { color: #ffc46a; }
.gp-off { display: block; margin-top: 2px; color: #a8601a; font-weight: 700; }
:root[data-theme="night"] .gp-off { color: #ffc46a; }
