/* inventory.theme.css — Inventory · ชั้นธีมใหม่ (แยกจาก theme2.css เดิม)
   ลำดับ <link> ใน index.html มีผลต่อการทับกันของกฎ — ไฟล์ชั้นเดียวกันเรียงตามเลขส่วน
   Beta 0.22.2: ลบกฎหน้าเก่า (.iv-*) ที่ไม่ได้ใช้แล้ว — หน้าใหม่ใช้ .iv2-* ด้านล่าง */
/* ===== ปุ่มขายตัวซ้ำ (inventory.js: sellSection → หน้าตัวละครเรียกผ่าน invSellHtml) ===== */
.iv-sell {
  display: flex;
  flex-direction: column;
  gap: 0.6vh;
}
.iv-sell small {
  font-size: 1.7vh;
  color: var(--k-ink2);
  text-align: center;
}
.iv-sell-row {
  display: flex;
  gap: 1vh;
}
.iv-sell-row .pv-btn {
  height: 5.6vh;
  font-size: 1.9vh;
}

/* ===== หน้าช่องเก็บของหน้าตาใหม่ (Beta 0.22.0) — เต็มจอ ธีมเดียวกับหน้ากาชา/แบทเทิลพาส/เควส =====
   วาดลง #app เอง (ไม่ผ่าน page2) · คลาส .iv2-* ทั้งหมด ไม่พึ่งกฎ .iv-* ด้านบน
   (.iv-sell ยังใช้ร่วมกับหน้าตัวละคร จึงคงชื่อเดิม) */
.iv2 {
  --iv2-ink: #3b4255;
  --iv2-soft: #6b7285;
  --iv2-pink: #e86a92;
  --iv2-det: max(44vh, 260px);
  position: fixed;
  inset: 0;
  overflow: hidden;
  color: var(--iv2-ink);
  font-family: Mali, Sarabun, sans-serif;
  background:
    repeating-linear-gradient(90deg, #3b425508 0 1px, transparent 1px 12vh),
    repeating-linear-gradient(0deg, #3b425508 0 1px, transparent 1px 12vh),
    linear-gradient(160deg, #fbf6f1, #efe7ea 60%, #e9e3ea);
}
.iv2 button {
  font: inherit;
  cursor: pointer;
}

/* ---------- แถบบน ---------- */
.iv2-top {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 11vh;
  display: flex;
  align-items: center;
  gap: 1.4vh;
  padding: 0 2.4vh;
  background: linear-gradient(#fffaf2f0, #fffaf200);
  z-index: 3;
}
.iv2-crumb {
  font: 800 max(14px, 2.6vh) / 1 Mali, sans-serif;
  white-space: nowrap;
}
.iv2-tabs {
  display: flex;
  gap: 0.8vh;
  margin-left: 1.4vh;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.iv2-tabs button {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.6vh;
  padding: max(5px, 1vh) max(10px, 1.8vh);
  border: 0;
  border-radius: 99px;
  background: #ffffffd0;
  color: var(--iv2-ink);
  box-shadow: 0 0.3vh 0.6vh #0001;
  font: 800 max(12px, 1.9vh) / 1 Mali, sans-serif !important;
  white-space: nowrap;
}
.iv2-tabs button.on {
  background: var(--iv2-ink);
  color: #fff;
}
.iv2-tabs small {
  min-width: max(16px, 2.4vh);
  padding: 0.2vh 0.5vh;
  border-radius: 99px;
  background: #3b425518;
  font: 800 max(10px, 1.4vh) / 1.2 Sarabun, sans-serif;
  text-align: center;
}
.iv2-tabs button.on small {
  background: #ffffff30;
}
.iv2-cur {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4vh;
  padding: 0.5vh 1.2vh 0.5vh 0.5vh;
  border-radius: 99px;
  background: #3b4255d8;
  color: #fff;
  font: 800 max(12px, 1.9vh) / 1 Georgia, serif;
  white-space: nowrap;
}
.iv2-cur:first-of-type {
  margin-left: auto;
}
.iv2-cur img {
  width: max(16px, 2.8vh);
  height: max(16px, 2.8vh);
  object-fit: contain;
}

/* ---------- เนื้อหา: ตารางของ (ซ้าย) · รายละเอียด (ขวา) ---------- */
.iv2-body {
  position: absolute;
  left: 2.4vh;
  right: 2.4vh;
  top: 12vh;
  bottom: 2.4vh;
  display: grid;
  grid-template-columns: 1fr var(--iv2-det);
  gap: 2vh;
}
.iv2-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(max(92px, 17vh), 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 1.6vh;
  padding: 1.8vh;
  overflow-y: auto;
  border-radius: 1.4vh;
  background: #fffaf2cc;
  box-shadow: 0 0.8vh 2vh #0001;
  scrollbar-width: thin;
}
.iv2-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8vh;
  padding: 0.9vh 0.9vh 1.1vh;
  border: 0;
  border-radius: 1.4vh;
  background: #fff;
  color: var(--iv2-ink);
  box-shadow: 0 0 0 1px #3b425514, 0 0.5vh 1vh #0001;
}
.iv2-cell.sel {
  box-shadow: 0 0 0 0.35vh var(--iv2-pink), 0 0.8vh 1.4vh #e86a9233;
}
.iv2-cell em {
  position: absolute;
  top: 0.6vh;
  left: 0.6vh;
  z-index: 2;
  padding: 0.2vh 0.9vh;
  border-radius: 99px;
  background: #4f9a5f;
  color: #fff;
  font: 800 max(10px, 1.5vh) / 1.3 Sarabun, sans-serif;
  font-style: normal;
}
.iv2-cell .iv2-qty {
  left: auto;
  right: 0.6vh;
  background: var(--iv2-ink);
}
.iv2-pv {
  width: 100%;
  height: max(64px, 14vh);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 1vh;
  background: linear-gradient(#f7f1f4, #ece3ea);
}
.iv2-pv > * {
  max-width: 100%;
  max-height: 100%;
}
.iv2-pv img {
  height: 100%;
  width: auto;
  object-fit: contain;
}
.iv2-cell b {
  font: 800 max(11px, 1.8vh) / 1.2 Sarabun, sans-serif;
  text-align: center;
}
.iv2-more .iv2-pv {
  font: 300 max(28px, 6vh) / 1 Georgia, serif;
  color: #c7a9b8;
  background: repeating-linear-gradient(45deg, #faf5f7 0 1vh, #f2eaee 1vh 2vh);
}
.iv2-itic {
  width: 78%;
  height: 78%;
  object-fit: contain;
}
.iv2-dupes {
  grid-column: 1 / -1;
  font: 600 max(11px, 1.6vh) / 1.4 Sarabun, sans-serif;
  color: var(--iv2-soft);
}

/* ---------- รายละเอียดของที่เลือก ---------- */
.iv2-det {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1.2vh;
  padding: 1.6vh;
  border-radius: 1.4vh;
  background: #fffaf2ee;
  box-shadow: 0 1vh 2.4vh #0002;
  overflow-y: auto;
  scrollbar-width: none;
}
.iv2-stage {
  flex: 1;
  min-height: max(90px, 20vh);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 1vh;
  background:
    linear-gradient(#fbf5f7, #f1e8ee);
  overflow: hidden;
}
.iv2-bigpv {
  display: flex;
  align-items: center;
  justify-content: center;
}
/* ตัวอย่างของในหน้าร้าน (prevBox) มีขนาดตายตัว — ขยายในจอแสดง */
.iv2-bigpv > * {
  transform: scale(1.7);
}
.iv2-itbig {
  width: max(80px, 22vh);
  height: max(80px, 22vh);
  object-fit: contain;
  transform: none !important;
}
.iv2-info small {
  display: block;
  font: 700 max(11px, 1.6vh) / 1.3 Sarabun, sans-serif;
  color: var(--iv2-pink);
}
.iv2-info b {
  display: block;
  font: 900 max(15px, 2.8vh) / 1.2 Mali, sans-serif;
}
.iv2-info p {
  margin: 0.6vh 0 0;
  font: 600 max(12px, 1.9vh) / 1.4 Sarabun, sans-serif;
  color: var(--iv2-soft);
}
/* ปุ่มหลัก: สูงพอดีนิ้ว ไม่ใหญ่เกิน (สูงสุด ~6vh) */
.iv2-btn {
  flex: none;
  height: max(32px, 6vh);
  padding: 0 2vh;
  border: 0;
  border-radius: 99px;
  display: grid;
  place-items: center;
  font: 900 max(12px, 2.1vh) / 1 Mali, sans-serif;
  white-space: nowrap;
}
.iv2-go {
  background: linear-gradient(#f9d77e, #e7a93a);
  color: #6b3f12;
  box-shadow: 0 0.5vh 0 #b97a1f, 0 0.8vh 1.4vh #0003;
}
.iv2-blue {
  background: var(--iv2-ink);
  color: #fff;
  box-shadow: 0 0.5vh 0 #22283a, 0 0.8vh 1.4vh #0003;
}
.iv2-go:active,
.iv2-blue:active {
  transform: translateY(0.3vh);
}
.iv2-using {
  background: none;
  color: #4f9a5f;
  box-shadow: inset 0 0 0 1px #4f9a5f66;
}

/* ---------- ไม่มีไอเทม ---------- */
.iv2-empty {
  grid-column: 1 / -1;
  align-self: center;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1vh;
  padding: 3vh 5vh;
  border-radius: 1.4vh;
  background: #fffaf2ee;
  box-shadow: 0 1vh 2.4vh #0002;
  text-align: center;
}
.iv2-empty i {
  width: max(44px, 9vh);
  height: max(44px, 9vh);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--iv2-ink);
  color: #fff;
}
.iv2-empty b {
  font: 900 max(14px, 2.6vh) / 1.2 Mali, sans-serif;
}
.iv2-empty small {
  font: 600 max(11px, 1.7vh) / 1.4 Sarabun, sans-serif;
  color: var(--iv2-soft);
}

/* จอสูง (คอม/แท็บเล็ต): ขยายตัวอย่างให้เต็มจอแสดงมากขึ้น */
@media (min-height: 600px) {
  .iv2-bigpv > * {
    transform: scale(2.3);
  }
}
/* จอเตี้ย (มือถือแนวนอน): แผงรายละเอียดแคบลง ตารางได้ที่มากขึ้น */
@media (max-height: 480px) {
  .iv2 {
    --iv2-det: 220px;
  }
  .iv2-bigpv > * {
    transform: scale(1.2);
  }
}
