/* ─── INVENTORY ──────────────────────────────────────────────────────────────
   Open-storybook inventory (Figma-matched, rc — 2026-06-02). Same visual
   family as the GEAR + SHOP tabs: the play-hub panel becomes the wood-framed
   open book (shop-book-bg.webp), the LEFT page holds a wood-framed loot grid
   of cream parchment tiles, and the RIGHT page is the selected item's detail
   (gold-framed portrait + name + stat + wooden EQUIP / UPGRADE / FUSE banners).

   Rarity palette mirrors equipment-runtime.js RARITY_COLORS:
     0 common #9aa3ad · 1 uncommon #5ec46a · 2 rare #4fa6ff
     3 ultra  #b674ff · 4 epic    #ffc23d · 5 mythic #ff5660
   On the parchment theme the rarity colour is reduced to a subtle tile
   keyline + the coloured rarity word in the detail; the tile face stays
   cream parchment (per the mock — "follow the theme, keep the icons").
   ─────────────────────────────────────────────────────────────────────────── */

/* The shared gold ornate corner-bracket frame (matches the GEAR tab's slot
   cards + the SHOP). Defined once as a CSS var so the grid frame and the
   detail portrait reuse the exact same border-image. */
:root {
  --iv-gold-frame: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='none'%3E%3ClinearGradient id='g' x1='0' x2='0' y1='0' y2='1'%3E%3Cstop offset='0' stop-color='%23f4d98e'/%3E%3Cstop offset='.45' stop-color='%23cda455'/%3E%3Cstop offset='1' stop-color='%238a6326'/%3E%3C/linearGradient%3E%3Crect x='7' y='7' width='86' height='86' rx='12' stroke='url(%23g)' stroke-width='5'/%3E%3Cpath d='M7 32 V18 Q7 7 18 7 H32' stroke='url(%23g)' stroke-width='13' stroke-linecap='round'/%3E%3Cpath d='M68 7 H82 Q93 7 93 18 V32' stroke='url(%23g)' stroke-width='13' stroke-linecap='round'/%3E%3Cpath d='M93 68 V82 Q93 93 82 93 H68' stroke='url(%23g)' stroke-width='13' stroke-linecap='round'/%3E%3Cpath d='M32 93 H18 Q7 93 7 82 V68' stroke='url(%23g)' stroke-width='13' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* Panel = the wood-framed open book (mirrors GEAR + SHOP). Scoped under
   #stage-select so it out-specifies the default gold/blue book-bg the
   play-hub paints for every tab. Top/bottom padding clears the absolute
   play-hub HUD and the floating bottom nav. */
#stage-select .play-hub-panel[data-tab="inventory"] {
  padding: clamp(50px, 8vh, 60px) 0 70px;
  background: #2a1a0e url('../assets/shop/shop-book-bg.webp') center center / cover no-repeat;
}
/* Dim the inactive bottom-nav tabs on this tab, matching the shop/gear mocks. */
#stage-select[data-active-tab="inventory"] .play-hub-tab:not(.is-active) { opacity: 0.55; }

/* Content column — width-locked + centred so the two pages land on the
   painted book pages at the ~1440 design width and scale down gracefully. */
.iv-root {
  position: relative;
  height: 100%;
  width: min(1180px, 95%);
  margin-inline: auto;
  color: #2e1d10;
  font-family: inherit;
}

/* ── decorative left-page title ──────────────────────────────────── */
.iv-title {
  flex: none;
  margin: 0 0 8px;
  text-align: center;
  font-family: 'EB Garamond', 'Cinzel', serif;
  font-weight: 700;
  font-size: clamp(24px, 3.4vw, 38px);
  line-height: 1.05;
  letter-spacing: 0.5px;
  font-variant: small-caps;
  text-transform: lowercase;
  color: #2e1d10;
  text-shadow: 0 1px 0 rgba(255, 248, 230, 0.45);
}
.iv-title::first-letter { text-transform: uppercase; font-size: 1.18em; }
/* flourish rule under the title (centred line with a small lozenge) */
.iv-title-rule {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 auto 10px;
  width: min(78%, 320px);
  color: #9a6f2e;
}
.iv-title-rule::before,
.iv-title-rule::after {
  content: "";
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(154, 111, 46, 0.65), transparent);
}
.iv-title-rule i {
  width: 8px; height: 8px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #f4d98e, #b88a36);
  box-shadow: 0 0 0 1.5px rgba(120, 84, 30, 0.5);
}

/* ── left page: wood-framed loot grid ────────────────────────────── */
.iv-page-left {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
/* Outer dark-wood frame with gold corner ornaments (border-image overlay). */
.iv-frame {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 16px;
  padding: 11px;
  background:
    linear-gradient(180deg, #4d301a 0%, #3a2310 52%, #2f1c0c 100%);
  box-shadow:
    inset 0 2px 2px rgba(255, 226, 180, 0.16),
    inset 0 0 0 1px rgba(255, 220, 150, 0.10),
    0 8px 22px rgba(20, 10, 4, 0.5);
}
.iv-frame::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  border: 16px solid transparent;
  border-image: var(--iv-gold-frame) 33 / 16px stretch;
  border-radius: 16px;
}

/* Inner recessed dark-wood well that the cream tiles float on (mock). */
.iv-scroll {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  padding: 6px 9px 12px;
  border-radius: 9px;
  background: linear-gradient(180deg, #2c1b0d 0%, #241509 100%);
  box-shadow: inset 0 2px 9px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(0, 0, 0, 0.4);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(180, 140, 80, 0.5) transparent;
}
.iv-scroll::-webkit-scrollbar { width: 7px; }
.iv-scroll::-webkit-scrollbar-thumb { background: rgba(180, 140, 80, 0.5); border-radius: 4px; }

/* Section header — centred gold caps with flanking flourish rules, on the
   dark wood well (mock: "MAIN GUN", "SUBWEAPON", "SHIELD"). */
.iv-sec-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 13px 4px 8px;
  font-family: 'EB Garamond', 'Cinzel', serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: #e7c684;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}
.iv-sec-head:first-child { margin-top: 4px; }
.iv-sec-head > span { flex: none; }
.iv-sec-head::before,
.iv-sec-head::after {
  content: "";
  flex: 1 1 auto;
  max-width: 70px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(214, 170, 90, 0.55), transparent);
}

/* Loot grid — fixed 7 columns on the book page (matches the mock); cells
   are square cream parchment tiles. (Portrait reflows below.) */
.iv-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
}

/* ── cell (cream parchment tile) ─────────────────────────────────── */
.iv-cell {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  cursor: pointer;
  border-radius: 9px;
  border: 1.5px solid color-mix(in srgb, var(--rc, #b89a63) 45%, #ab8b56);
  background: linear-gradient(180deg, #f4e8ca 0%, #e6d3a6 100%);
  color: #5a3f22;
  box-shadow:
    inset 0 1px 0 rgba(255, 251, 238, 0.7),
    inset 0 -3px 5px rgba(120, 88, 42, 0.22),
    0 1px 2px rgba(30, 16, 6, 0.4);
  transition: transform 0.1s ease, box-shadow 0.15s ease, filter 0.12s ease;
}
/* ── Jelly Candy Gem rarity backgrounds (owner pick T, 2026-06-07) ──────────
   The tile background IS the rarity: six glossy candy-gem surfaces mapped to
   real stones (Moonstone → Emerald → Sapphire → Amethyst → Imperial Topaz →
   Ruby), with a thick white candy-coat rim, a glass gloss highlight
   (::before), injected twinkling sparkles (.iv-spark spans, count grows with
   tier — src/inventory-tab.js), and a slow light-sweep on Epic/Mythic
   (::after). Replaces the corner-gem indicator AND the parchment surface on
   gear cells; empty/ghost cells keep the parchment look. Pure gradients —
   no images, cheap on mobile. */
.iv-cell[class*="iv-r"] {
  border-radius: 14px;
  border: 2.5px solid rgba(255, 255, 255, 0.78);
  color: #ffffff;
  overflow: hidden;
  box-shadow:
    0 3px 8px rgba(30, 16, 6, 0.4),
    inset 0 -6px 12px rgba(0, 0, 0, 0.18),
    inset 0 4px 8px rgba(255, 255, 255, 0.25);
}
/* Moonstone — darkened twice from the mock (#ffffff/#dfe3f2/#aab1d4) per
   owner: the common tile kept reading too light against the cream page.
   Current values ≈20% darker than the first darkening pass. */
.iv-cell.iv-r0 { background: radial-gradient(90% 90% at 50% 38%, #c9cedd 0%, #8a91ad 52%, #545d7e 100%); }
.iv-cell.iv-r1 { background: radial-gradient(90% 90% at 50% 38%, #8af0b4 0%, #3ecc7c 55%, #1a9a54 100%); }
.iv-cell.iv-r2 { background: radial-gradient(90% 90% at 50% 38%, #7fc3ff 0%, #3e8ef0 55%, #1f5cc0 100%); }
.iv-cell.iv-r3 { background: radial-gradient(90% 90% at 50% 38%, #d9a6ff 0%, #a861ec 55%, #7430bc 100%); }
.iv-cell.iv-r4 { background: radial-gradient(90% 90% at 50% 38%, #ffd980 0%, #ffab2e 55%, #e07c0e 100%); }
.iv-cell.iv-r5 { background: radial-gradient(90% 90% at 50% 38%, #ff92a8 0%, #f24a6a 55%, #c01d3e 100%); }
/* Glass gloss — the candy dome highlight. */
.iv-cell[class*="iv-r"]::before {
  content: '';
  position: absolute;
  left: 10%; right: 40%; top: 6%; height: 30%;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.10) 80%, transparent);
  transform: rotate(-8deg);
  pointer-events: none;
  z-index: 1;
}
/* Twinkling 4-point sparkles (spans injected per cell, 1–3 by tier). */
.iv-spark {
  position: absolute;
  width: 13px; height: 13px;
  pointer-events: none;
  z-index: 2;
  animation: iv-twinkle 2.6s ease-in-out infinite, iv-pop 5.2s ease-in-out infinite;
}
.iv-spark::before, .iv-spark::after {
  content: '';
  position: absolute; left: 50%; top: 50%;
  border-radius: 2px;
  background: linear-gradient(180deg, transparent, #fff 45%, #fff 55%, transparent);
}
.iv-spark::before { width: 1.8px; height: 100%; transform: translate(-50%, -50%); }
.iv-spark::after  { width: 100%; height: 1.8px; transform: translate(-50%, -50%); background: linear-gradient(90deg, transparent, #fff 45%, #fff 55%, transparent); }
@keyframes iv-twinkle {
  0%, 100% { opacity: 0; transform: scale(0.45) rotate(0deg); }
  50%      { opacity: 1; transform: scale(1) rotate(18deg); }
}
@keyframes iv-pop {
  0%, 78%, 100% { transform: scale(1); }
  86% { transform: scale(1.28) rotate(10deg); }
  92% { transform: scale(0.94); }
}
/* Slow luxury light-sweep — Epic + Mythic only. */
.iv-cell.iv-r4::after, .iv-cell.iv-r5::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(112deg, transparent 40%, rgba(255, 255, 255, 0.28) 50%, transparent 60%);
  background-size: 240% 100%;
  animation: iv-sheen 4.2s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}
@keyframes iv-sheen {
  0% { background-position: 150% 0; }
  55% { background-position: -70% 0; }
  100% { background-position: -70% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .iv-spark { animation: none; opacity: 0.75; transform: scale(0.8); }
  .iv-cell.iv-r4::after, .iv-cell.iv-r5::after { animation: none; background: none; }
}
/* Selection ring must out-shout the candy coat. */
.iv-cell[class*="iv-r"].iv-sel { border-color: #f4c64f; }
.iv-cell:hover { transform: translateY(-1px); filter: brightness(1.03); }
.iv-cell:active { transform: translateY(0); }
.iv-cell.iv-sel {
  border-color: #f4c64f;
  box-shadow:
    0 0 0 2px rgba(255, 210, 90, 0.95),
    0 0 13px rgba(255, 190, 70, 0.7),
    inset 0 1px 0 rgba(255, 251, 238, 0.7);
}
.iv-spare { filter: saturate(0.85) brightness(0.97); }
.iv-spare:hover { filter: saturate(0.9) brightness(1.0); }

/* Empty placeholder slot — recessed cream, no interaction (mock pads each
   section's rows with these). */
.iv-empty-cell {
  aspect-ratio: 1;
  border-radius: 9px;
  border: 1.5px solid rgba(120, 92, 50, 0.5);
  background: linear-gradient(180deg, #d6c39a 0%, #c8b489 100%);
  box-shadow: inset 0 2px 6px rgba(70, 46, 18, 0.4), inset 0 0 0 1px rgba(255, 245, 220, 0.18);
  opacity: 0.72;
}

/* Art + glyph — dark on the cream tile (the baked 3D thumbnail keeps its
   own colour; the fallback glyph reads as an engraving). */
.iv-art {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.iv-glyph {
  width: 50%; height: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #5a3f22;
  filter: drop-shadow(0 1px 1px rgba(255, 250, 235, 0.5));
}
.iv-glyph svg { width: 100%; height: 100%; }
.iv-glyph-mat { width: 44%; height: 44%; }
.iv-thumb {
  width: 92%; height: 92%;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(60, 38, 14, 0.45));
  pointer-events: none;
}

/* corner badges */
.iv-lv {
  position: absolute; left: 5px; bottom: 4px;
  font: 800 9.5px/1 inherit; color: #3a2510;
  text-shadow: 0 1px 0 rgba(255, 248, 230, 0.6);
}
.iv-qty {
  position: absolute; right: 5px; bottom: 4px;
  font: 800 10px/1 inherit; color: #3a2510;
  text-shadow: 0 1px 0 rgba(255, 248, 230, 0.6);
}
.iv-copies {
  position: absolute; right: 5px; bottom: 4px;
  font: 800 9px/1 inherit; color: #7a5a2c; letter-spacing: 0.2px;
  text-shadow: 0 1px 0 rgba(255, 248, 230, 0.55);
}
.iv-copies.is-ready { color: #b07d14; }
.iv-eqp {
  position: absolute; right: 4px; top: 4px;
  width: 15px; height: 15px; border-radius: 50%;
  background: linear-gradient(180deg, #f4d98e, #cda052);
  color: #3a2510;
  font: 900 9px/15px inherit; text-align: center;
  box-shadow: 0 0 0 1.5px #2c1b0d, 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* materials use the slot accent glyph on the same cream tile */
.iv-cell.iv-mat .iv-glyph-mat { color: var(--rc, #8a6326); }

/* superweapons — a regal gold-warmed tile */
.iv-cell.iv-super {
  background: linear-gradient(180deg, #f7ecca 0%, #efd79c 100%);
  border-color: #d4a64a;
}
.iv-cell.iv-super .iv-glyph { color: #9a6f1e; }

/* ── right page: item detail ─────────────────────────────────────── */
/* On the book layout (landscape) the detail sits directly on the painted
   parchment right page — no panel chrome. Portrait turns it into a sheet. */
.iv-detail {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #2e1d10;
}
.iv-detail-empty {
  display: block;
  color: #6f5c47;
  font-size: 13px;
  line-height: 1.6;
  padding: 0 24px;
}
.iv-detail.is-open .iv-detail-empty { display: none; }
.iv-detail-card { position: relative; width: 100%; max-width: 360px; padding: 4px 8px; }

.iv-detail-close {
  position: absolute; right: 2px; top: -2px;
  width: 30px; height: 30px; border-radius: 50%;
  border: 1.5px solid #8a6a3a;
  background: linear-gradient(180deg, #ecdcb6, #d8c191);
  color: #4a3722; font-size: 18px; line-height: 1; cursor: pointer;
  display: none;
}

/* gold-framed portrait (mock) — parchment inside the same ornate gold frame */
.iv-detail-art {
  width: clamp(122px, 15vw, 168px);
  aspect-ratio: 1;
  margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  border: 16px solid transparent;
  border-image: var(--iv-gold-frame) 33 / 16px stretch;
  border-radius: 14px;
  background: linear-gradient(180deg, #f4e8ca 0%, #e3cfa0 100%);
  color: #5a3f22;
  box-shadow: 0 7px 18px rgba(30, 16, 6, 0.4);
}
.iv-detail-art .iv-thumb { width: 88%; height: 88%; }
.iv-detail-art svg { width: 52%; height: 52%; }
/* Detail panel art box wears the same candy-gem surface as the grid cell
   (gold Figma frame kept — it doubles as the gem's setting). */
.iv-detail-art.iv-r0 { background: radial-gradient(90% 90% at 50% 38%, #c9cedd 0%, #8a91ad 52%, #545d7e 100%); }
.iv-detail-art.iv-r1 { background: radial-gradient(90% 90% at 50% 38%, #8af0b4 0%, #3ecc7c 55%, #1a9a54 100%); }
.iv-detail-art.iv-r2 { background: radial-gradient(90% 90% at 50% 38%, #7fc3ff 0%, #3e8ef0 55%, #1f5cc0 100%); }
.iv-detail-art.iv-r3 { background: radial-gradient(90% 90% at 50% 38%, #d9a6ff 0%, #a861ec 55%, #7430bc 100%); }
.iv-detail-art.iv-r4 { background: radial-gradient(90% 90% at 50% 38%, #ffd980 0%, #ffab2e 55%, #e07c0e 100%); }
.iv-detail-art.iv-r5 { background: radial-gradient(90% 90% at 50% 38%, #ff92a8 0%, #f24a6a 55%, #c01d3e 100%); }
.iv-detail-art.iv-mat { font-size: 46px; color: var(--rc, #8a6326); }
.iv-detail-art.iv-super { background: linear-gradient(180deg, #f7ecca 0%, #efd79c 100%); color: #9a6f1e; }
/* …and the same candy coat as the grid cells (2026-06-07): white rim (an
   inset ring — the element's real border is the gold frame), glass gloss
   dome (::before), sparkles (injected in _detailHtml) and the Epic/Mythic
   light-sweep (::after), so the detail gem reads jelly instead of a flat
   colour fill. Matches the .iv-cell[class*="iv-r"] recipe above. */
.iv-detail-art[class*="iv-r"] {
  position: relative;
  overflow: hidden;
  box-shadow:
    0 7px 18px rgba(30, 16, 6, 0.4),
    inset 0 0 0 3px rgba(255, 255, 255, 0.78),
    inset 0 -8px 14px rgba(0, 0, 0, 0.18),
    inset 0 6px 10px rgba(255, 255, 255, 0.25);
}
.iv-detail-art[class*="iv-r"]::before {
  content: '';
  position: absolute;
  left: 10%; right: 40%; top: 6%; height: 30%;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.10) 80%, transparent);
  transform: rotate(-8deg);
  pointer-events: none;
  z-index: 1;
}
.iv-detail-art.iv-r4::after, .iv-detail-art.iv-r5::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(112deg, transparent 40%, rgba(255, 255, 255, 0.28) 50%, transparent 60%);
  background-size: 240% 100%;
  animation: iv-sheen 4.2s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}
/* Bigger sparkles for the bigger gem (13px is sized for the ~60px tile). */
.iv-detail-art .iv-spark { width: 18px; height: 18px; }
@media (prefers-reduced-motion: reduce) {
  .iv-detail-art.iv-r4::after, .iv-detail-art.iv-r5::after { animation: none; background: none; }
}

.iv-detail-name {
  font-family: 'EB Garamond', 'Cinzel', serif;
  font-weight: 700;
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.1;
  color: #2e1d10;
  text-shadow: 0 1px 0 rgba(255, 248, 230, 0.4);
}
.iv-detail-sub {
  font-family: 'EB Garamond', 'Cinzel', serif;
  font-weight: 700;
  font-size: clamp(14px, 1.5vw, 18px);
  letter-spacing: 0.4px;
  margin-top: 3px;
  color: #5a4630;
}
.iv-detail-sub .iv-rarity { font-weight: 800; }

/* stat block — "ATTACK POWER  34,444" (mock). dt+dd inline + centred. */
.iv-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 3px 12px;
  margin: 14px 0 4px;
}
.iv-stats dt {
  font-family: 'EB Garamond', 'Cinzel', serif;
  font-weight: 700; font-size: clamp(13px, 1.4vw, 16px);
  letter-spacing: 1px; text-transform: uppercase; color: #5a4630;
}
.iv-stats dd {
  font-family: 'EB Garamond', 'Cinzel', serif;
  font-weight: 800; font-size: clamp(17px, 1.9vw, 22px);
  color: #2e1d10; margin: 0;
}
.iv-detail-desc {
  font-size: clamp(12px, 1.25vw, 14.5px);
  line-height: 1.5;
  color: #5a4630;
  margin: 9px auto 0;
  max-width: 320px;
}
.iv-detail-spares { font: 700 11px/1 inherit; color: #7a5a2c; margin-top: 9px; }

/* ── wooden banner action buttons (EQUIPPED / UPGRADE / FUSE) ─────── */
.iv-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 18px auto 0;
  max-width: 340px;
}
.iv-act {
  flex: 1 1 132px;
  min-width: 120px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 11px 14px;
  border-radius: 9px;
  border: 2px solid #271509;
  cursor: pointer;
  font-family: 'EB Garamond', 'Cinzel', serif;
  font-weight: 700; font-size: 14px;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: #f6e6c2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  background: linear-gradient(180deg, #7c5331 0%, #5e3c20 50%, #4a2d15 100%);
  box-shadow:
    inset 0 0 0 2px rgba(212, 170, 90, 0.55),
    inset 0 2px 0 rgba(255, 228, 180, 0.32),
    inset 0 -3px 6px rgba(0, 0, 0, 0.35),
    0 3px 7px rgba(20, 10, 4, 0.45);
  transition: transform 0.1s ease, filter 0.12s ease;
}
.iv-act:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.08); }
.iv-act:active:not(:disabled) { transform: translateY(0) scale(0.98); }
.iv-act-sub {
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.4px;
  text-transform: none; color: #eccf8c; opacity: 0.92;
}
/* FUSE drops to its own full-width row beneath EQUIP + UPGRADE (mock). */
.iv-act-fu { flex-basis: 100%; }
/* equipped = pressed/inset wood, non-interactive */
.iv-act-eq.is-on {
  background: linear-gradient(180deg, #3e2814 0%, #2c1a0c 100%);
  color: #cdaf7e;
  box-shadow:
    inset 0 0 0 2px rgba(150, 110, 55, 0.5),
    inset 0 2px 7px rgba(0, 0, 0, 0.55);
  cursor: default;
}
.iv-act.is-broke { opacity: 0.55; }
.iv-act:disabled { cursor: default; }
.iv-shard-ic { display: inline-flex; width: 11px; height: 11px; vertical-align: -1px; }
.iv-shard-ic svg { width: 100%; height: 100%; }

/* ── confirmation toast ──────────────────────────────────────────── */
.iv-toast {
  position: absolute;
  left: 50%; bottom: 16px;
  transform: translate(-50%, 12px);
  z-index: 9;
  padding: 9px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f4d98e, #cda052);
  border: 1.5px solid #8a6326;
  color: #2e1d10;
  font: 800 12.5px/1 inherit; letter-spacing: 0.3px;
  box-shadow: 0 8px 24px rgba(20, 10, 4, 0.5);
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
  white-space: nowrap; max-width: 90%; overflow: hidden; text-overflow: ellipsis;
}
.iv-toast.show { opacity: 1; transform: translate(-50%, 0); }
.iv-toast.is-error { background: linear-gradient(180deg, #e88b5a, #c75636); border-color: #8a3a1e; color: #fff5ec; }

.iv-empty, .iv-loading {
  text-align: center; color: #6f5c47; font-size: 13px;
  padding: 48px 24px; line-height: 1.6;
}

/* ═══ LANDSCAPE — the two-page open book (desktop + landscape phone) ═══
   The grid frame sits on the left page; the detail on the right page. */
@media (orientation: landscape) {
  .iv-root {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: clamp(20px, 5%, 64px);
    padding-top: clamp(8px, 2vh, 20px);
  }
  .iv-page-left { flex: 1 1 0; }
  .iv-detail {
    flex: 1 1 0;
    min-width: 0;
    align-self: stretch;
    overflow-y: auto;
    padding: 10px 14px;
  }
  /* right page always shows content (auto-selected first item on render) */
  .iv-detail-close { display: none; }
}

/* ═══ PORTRAIT — drop the two-page conceit: full-width grid + bottom-sheet
   detail (mirrors the SHOP tab's portrait fallback). ═══ */
@media (orientation: portrait) {
  .iv-root { display: block; }
  .iv-page-left { height: 100%; }
  .iv-grid { grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 8px; }
  .iv-detail {
    position: absolute;
    left: 8px; right: 8px; bottom: 0;
    z-index: 4;
    max-height: 66%;
    overflow-y: auto;
    border: 1.5px solid #8a6a3a;
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    background: linear-gradient(180deg, #f1e3c2 0%, #e6d3a6 100%);
    box-shadow: 0 -14px 40px rgba(20, 10, 4, 0.5);
    transform: translateY(108%);
    transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
    padding: 16px 14px 18px;
  }
  .iv-detail.is-open { transform: translateY(0); pointer-events: auto; }
  .iv-detail:not(.is-open) .iv-detail-empty { display: none; }
  .iv-detail-close { display: block; }
}

/* Mobile-landscape (short, wide phones) — shrink chrome so the grid + detail
   both fit a short viewport. */
@media (orientation: landscape) and (max-height: 500px) {
  #stage-select .play-hub-panel[data-tab="inventory"] { padding-top: 44px; padding-bottom: 60px; }
  .iv-title { font-size: clamp(18px, 4.5vh, 26px); margin-bottom: 4px; }
  .iv-title-rule { margin-bottom: 6px; }
  .iv-grid { gap: 5px; }
  .iv-frame { padding: 8px; }
  .iv-sec-head { font-size: 10.5px; margin: 9px 4px 6px; }
  .iv-detail-art { width: clamp(96px, 22vh, 132px); border-width: 12px; }
  .iv-detail-name { font-size: clamp(18px, 5vh, 24px); }
  .iv-act { padding: 8px 12px; font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .iv-detail { transition: none; }
}
