/* ============================
   Inventory Page (Small Cards + Soft Overlay)
   Scoped: inventory-page + inv-*
============================ */

.inventory-page {
  width: 100%;
}

/* Grid (small cards) */
.inventory-page .inventory-grid--small {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

/* Small card as a button */
.inventory-page .inv-card {
  width: 100%;
  text-align: center;
  cursor: pointer;

  background: var(--paper-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);

  padding: 12px 10px;
  color: inherit;
}


.inventory-page .inv-card:hover {
  background: #ece9e0;
}

.inventory-page .inv-card:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(111, 127, 87, 0.22);
}

.inventory-page .inv-card.is-selected {
  border-color: #6f7f57;
  box-shadow: 0 0 0 3px rgba(111, 127, 87, 0.16);
}

/* Icon */

.inventory-page .inv-card__placeholder {
  font-weight: 800;
  color: #6f756f;
  font-size: 16px;
}

.inventory-page .inv-card__name {
  font-weight: 700;
  font-size: 13px;
  color: #3e3b34;
  margin-bottom: 6px;
}

.inventory-page .inv-card__meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  color: #6f756f;
}

.inventory-page .inv-card__tier {
  background: #f7f4ec;
  border: 1px solid #d4d1c9;
  padding: 2px 8px;
  border-radius: 999px;
}

.inventory-page .inv-card__uses strong {
  color: #3e3b34;
}

/* Empty state keeps your existing styles if any, but add mild defaults */
.inventory-page .inventory-empty {
  margin-top: 16px;
  background: #f0efe9;
  border: 1px solid #d4d1c9;
  border-radius: 14px;
  padding: 16px;
}

.inventory-page .inventory-empty-text {
  font-weight: 700;
  margin-bottom: 6px;
}

.inventory-page .inventory-empty-subtext {
  color: #6f756f;
  font-size: 13px;
}

/* ============================
   Overlay (soft, in-page feel)
============================ */

.inv-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: flex-start;
  justify-content: center;

  /* soft dim, not aggressive */
  background: rgba(0, 0, 0, 0.22);
  padding: 18px;
  padding-top: 200px; /* clears top nav + feels intentional */
}

.inv-overlay.is-hidden {
  display: none;
}

.inv-overlay__panel {
  width: 420px;
  max-width: 92vw;

   max-height: 90vh;        /* ✅ ADD */
  overflow-y: auto;        /* ✅ ADD */

  background: var(--paper-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  box-shadow: 0 16px 40px rgba(0,0,0,0.28);

  padding: 16px 16px 14px 16px;
  position: relative;
}

.inv-overlay__close {
  position: absolute;
  top: 10px;
  right: 12px;

  border: none;
  background: transparent;
  cursor: pointer;

  font-size: 22px;
  line-height: 1;
  color: #3e3b34;
}

.inv-ov__header {
  display: flex;
  gap: 14px;
  padding-right: 26px;
}

.inv-ov__icon {
  width: 82px;
  height: 82px;
  border-radius: 16px;
  background: var(--paper-3);
border: 1px solid var(--border-soft);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.inv-ov__placeholder {
  font-weight: 800;
  color: #6f756f;
  font-size: 18px;
}

.inv-ov__title {
  margin: 0;
  font-size: 18px;
  color: #3e3b34;
}

.inv-ov__subtitle {
  margin-top: 2px;
  color: #6f756f;
  font-size: 13px;
}

.inv-ov__usesLine {
  margin-top: 8px;
  color: #3e3b34;
  font-size: 13px;
}

.inv-ov__body {
  margin-top: 14px;
}

.inv-ov__label {
  display: block;
  font-size: 13px;
  color: #3e3b34;
  margin-bottom: 6px;
  font-weight: 700;
}

.inv-ov__select {
  width: 100%;
  background: var(--paper-3);
border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 13px;
  color: #3e3b34;
}

.inv-ov__primary {
  width: 100%;
  margin-top: 10px;

  border: 1px solid #c8c3b7;
  background: #6f7f57;
  color: #ffffff;

  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
}

.inv-ov__primary:hover {
  background: #5d6c48;
}

.inv-ov__primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.inv-ov__link {
  width: 100%;
  margin-top: 10px;

  border: none;
  background: transparent;
  cursor: pointer;

  color: #7b3f3f;
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
}

/* Message area */
.inv-ov__message {
  margin-top: 12px;
  background: var(--paper-3);
border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 10px;
  font-size: 13px;
  color: #3e3b34;
}

.inv-ov__message a {
  color: #4f5a3f;
  font-weight: 800;
  text-decoration: underline;
}

/* Discard confirm */
.inv-ov__confirm {
  margin-top: 12px;
  background: var(--paper-3);
border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 10px;
}

.inv-ov__confirmText {
  font-size: 13px;
  font-weight: 800;
  color: #3e3b34;
  margin-bottom: 8px;
}

.inv-ov__confirmActions {
  display: flex;
  gap: 10px;
}

.inv-ov__danger {
  flex: 1;
  border: 1px solid #c8c3b7;
  background: #7b3f3f;
  color: #fff;
  padding: 9px 10px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
}

.inv-ov__danger:hover {
  opacity: 0.92;
}

.inv-ov__ghost {
  flex: 1;
  border: 1px solid #c8c3b7;
  background: #b9bdb4;
  color: #2f2e2a;
  padding: 9px 10px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
}

.inv-ov__ghost:hover {
  background: #aeb2a9;
}

/* Fade out (used when item hits 0 and we remove its card) */
.inventory-page .inv-card.is-fading {
  opacity: 0;
  transition: opacity 0.5s ease;
}
.inv-ov__desc {
  margin: 6px 0 8px 0;
  font-size: 13px;
  color: #5f5c55;
  line-height: 1.4;
}

/* ===============================
   Inventory Polish Pass (Safe)
   Paste at END of inventory.css
================================ */

/* ---------- View Toggle ---------- */
.inv-viewtoggle {
  align-items: center;
}

.inv-viewbtn {
  border: 1px solid #d4d1c9;
  background: #f0efe9;
  color: #3e3b34;

  padding: 6px 12px;
  border-radius: 999px;

  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.inv-viewbtn:hover {
  background: #ece9e0;
}

.inv-viewbtn.is-active {
  background: #6f7f57;
  border-color: #6f7f57;
  color: #ffffff;
}

/* ---------- Card Depth ---------- */
.inventory-page .inv-card {
  transition:
    background 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}

.inventory-page .inv-card:hover {
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
  border-color: #c8c3b7;
}

/* Selected card slightly stronger, but calm */
.inventory-page .inv-card.is-selected {
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

/* ---------- Card Meta Hierarchy ---------- */
.inventory-page .inv-card__meta {
  margin-top: 2px;
  font-size: 11px;
  color: #7a7f74;
}

.inventory-page .inv-card__uses strong {
  color: #3e3b34;
  font-weight: 800;
}

/* ---------- Card Name Refinement ---------- */
.inventory-page .inv-card__name {
  letter-spacing: 0.2px;
}

/* ---------- Overlay Softening ---------- */
.inv-overlay__panel {
  border-color: #c8c3b7;
}

.inv-overlay__close:hover {
  opacity: 0.7;
}

/* ---------- Discard Link Calm ---------- */
.inv-ov__link:hover {
  text-decoration: none;
  opacity: 0.85;
}

/* ---------- Quantity Select (Discard) ---------- */
#inv-ov-qty {
  margin-top: 4px;
}

/* ---------- Empty State Calm ---------- */
.inventory-page .inventory-empty {
  text-align: center;
}

/* ---------- Motion Safety ---------- */
@media (prefers-reduced-motion: reduce) {
  .inventory-page .inv-card {
    transition: none;
  }
}

/* ===============================
   Inventory Item Icons (90x90)
================================ */

.inv-card__icon {
  width: 90px;
  height: 90px;
  background-color: #6b4f2a; /* same brown */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.inv-card__icon img {
  width: 90px;
  height: 90px;
  object-fit: contain; /* crop like shop */
  display: block;
}
.inv-card__icon,
.inv-ov__icon {
  width: 90px;
  height: 90px;
  background-color: #6b4f2a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.inv-card__icon img,
.inv-ov__icon img {
  width: 90px;
  height: 90px;
  object-fit: contain;
  display: block;
}
/* ===============================
   Inventory Item Icons (Final Centered)
================================ */

.inventory-page .inv-card__icon,
.inventory-page .inv-ov__icon {
  width: 90px;
  height: 90px;
  background: var(--paper-3);
  border: 1px solid var(--border-soft);
  border-radius: 14px;

  display: grid;
  place-items: center;

  margin: 0 auto 8px auto; /* 👈 THIS fixes centering */
}

.inventory-page .inv-card__icon img,
.inventory-page .inv-ov__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* fills container without cropping */
  object-position: center; /* forces center alignment */
  display: block;
}
/* =========================================
   Inventory Icon Image Fix (No Distortion)
   Safe override — preserves all layout
========================================= */

.inventory-page .inv-card__icon img,
.inventory-page .inv-ov__icon img {

  /* Override fixed 90x90 image sizing */
  width: auto !important;
  height: auto !important;

  /* Scale inside container without distortion */
  max-width: 100%;
  max-height: 100%;

  object-fit: contain;
  object-position: center;

  display: block;
}