/* Inventory (/inventory/) to the Wardrobe / Profile / Community standard: hero with a
   summary, category chips, owned NFTs as rarity-toned tiles and sealed crates as their
   own highlighted band. Mobile first (375px phones); the portal rail takes 245px from
   751px. Every rule is scoped to the inventory page. The crate list itself is rendered
   by crates.js and styled by crates.css; this file only re-skins it in place. */

body[data-page="inventory"] {
  --inv-blue: #f2f2f0;
  --inv-blue-hover: #ffffff;
  --inv-blue-ink: #0b0b0c;
  --inv-violet: #e8e8e6;
  --inv-navy: #161616;
  --inv-navy-deep: #131313;
  --inv-tile: #1d1d1d;
  --inv-line: #3a3a3a;
  --inv-line-strong: #535353;
  --inv-ink: #f4f4f4;
  --inv-ink-soft: #c9c9c9;
  --inv-ink-dim: #a1a1a1;
  --inv-ease: cubic-bezier(.2, .7, .2, 1);
  --tone: var(--rarity-common);
  background: #0d0d0d;
  color: var(--inv-ink);
}
body[data-page="inventory"] .portal-main { max-width: 1240px; overflow-x: clip; }

/* Shared type + controls ---------------------------------------------------- */
body[data-page="inventory"] :is(h1, h2, h3) { font-weight: 800; letter-spacing: -.035em; line-height: 1; text-transform: uppercase; }
body[data-page="inventory"] .eyebrow { margin: 0 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .14em; color: #bcbcbc; }
body[data-page="inventory"] :is(a, button, input, select, summary):focus-visible { outline: 3px solid #ffffff; outline-offset: 3px; }
body[data-page="inventory"] .button { min-height: 44px; padding: 12px 18px; border-radius: 9px; border-color: var(--inv-line); font-size: 11px; font-weight: 700; letter-spacing: .08em; white-space: normal; text-align: center; transition: background-color .2s ease, border-color .2s ease, color .2s ease, transform .2s var(--inv-ease); }
body[data-page="inventory"] .button:hover { border-color: var(--inv-blue); background: rgba(154, 154, 154, .08); }
body[data-page="inventory"] .button.filled { background: var(--inv-blue); border-color: var(--inv-blue); color: var(--inv-blue-ink); }
body[data-page="inventory"] .button.filled:hover { background: var(--inv-blue-hover); border-color: var(--inv-blue-hover); transform: translateY(-1px); }
.inv-icon { flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Hero + summary --------------------------------------------------------------- */
.inv-hero { position: relative; isolation: isolate; display: grid; gap: 18px; overflow: hidden; margin: 0 0 18px; padding: 22px 18px 18px; border: 1px solid var(--inv-line); border-radius: 18px; background: radial-gradient(90% 70% at 0% 0%, rgba(154, 154, 154, .26), transparent 60%), radial-gradient(70% 70% at 100% 10%, rgba(142, 142, 142, .22), transparent 62%), linear-gradient(180deg, #1c1c1c, var(--inv-navy-deep)); box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.inv-hero-copy { display: grid; gap: 12px; min-width: 0; }
.inv-hero .inv-eyebrow { margin: 0; color: var(--inv-blue); }
body[data-page="inventory"] .inv-hero h1 { margin: 0; font-size: clamp(44px, 13vw, 84px); line-height: .88; letter-spacing: -.05em; }
.inv-hero-lede { max-width: 52ch; color: var(--inv-ink-soft); font-size: 15px; line-height: 1.55; }
.inv-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.inv-hero-actions .button { flex: 1 1 auto; padding-left: 14px; padding-right: 14px; white-space: nowrap; }
.inv-shelf { display: none; }
.inv-shelf[hidden] { display: none !important; }
.inv-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.inv-stat { position: relative; display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 12px 10px; border: 1px solid var(--inv-line); border-radius: 12px; background: rgba(19, 19, 19, .78); transition: border-color .25s ease, box-shadow .25s ease; }
.inv-stat dt { display: flex; align-items: flex-start; gap: 6px; min-height: 2.6em; color: var(--inv-ink-dim); font-size: 9px; font-weight: 800; letter-spacing: .1em; line-height: 1.3; text-transform: uppercase; }
.inv-stat dt .inv-icon { width: 15px; height: 15px; color: #bcbcbc; }
.inv-stat dd { display: grid; gap: 2px; margin: 0; color: #fff; font-size: clamp(24px, 7vw, 34px); font-weight: 800; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.inv-stat-link { display: inline-flex; align-items: center; min-height: 44px; color: #b8b8b8; font-size: 10px; font-weight: 700; letter-spacing: .06em; line-height: 1.2; text-transform: uppercase; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 4px; transition: color .2s ease, text-decoration-color .2s ease; }
.inv-stat-link:hover { color: #e3e3e3; text-decoration-color: currentColor; }
.inv-stat-crates dt .inv-icon { color: #b8b8b8; }
.inv-stat-crates.has-crates { border-color: rgba(167, 167, 167, .7); box-shadow: 0 0 26px rgba(142, 142, 142, .25); }
.inv-stat-crates.has-crates dd > span { color: #d8d8d8; }

/* Toolbar: search, refresh and category chips ---------------------------------- */
.inv-toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 22px; }
.inv-search { position: relative; display: flex; flex: 1 1 0; align-items: center; min-width: 0; }
.inv-search .inv-icon { position: absolute; left: 15px; color: var(--inv-ink-dim); pointer-events: none; }
body.portal[data-page="inventory"] .inv-search input[type="search"] { width: 100%; min-height: 48px; padding: 12px 14px 12px 42px; border: 1px solid var(--inv-line); border-radius: 10px; background: var(--inv-navy-deep); color: #fff; font-size: 15px; transition: border-color .18s ease, box-shadow .18s ease; }
body.portal[data-page="inventory"] .inv-search input[type="search"]::placeholder { color: var(--inv-ink-dim); }
body.portal[data-page="inventory"] .inv-search input[type="search"]:hover { border-color: var(--inv-line-strong); }
body.portal[data-page="inventory"] .inv-search input[type="search"]:focus { border-color: var(--inv-blue); }
/* Same 3px ring as every other control (the old soft glow was about 1.5:1). */
body.portal[data-page="inventory"] .inv-search input[type="search"]:focus-visible { outline: 3px solid #ffffff; outline-offset: 2px; }
.inv-search input::-webkit-search-cancel-button { filter: invert(1); opacity: .6; }
body[data-page="inventory"] .inv-refresh { flex: none; gap: 8px; min-height: 48px; padding: 12px 14px; }
body[data-page="inventory"] .inv-refresh[aria-disabled="true"] { cursor: progress; opacity: .7; }
.inv-chips { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 7px; }
.inv-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 13px; border: 1px solid #444444; border-radius: 9px; background: #212121; color: var(--inv-ink-soft); font-size: 12px; font-weight: 700; letter-spacing: .03em; cursor: pointer; transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease; }
.inv-chip:hover { border-color: var(--inv-blue); color: #fff; }
.inv-chip[aria-pressed="true"] { background: #f2f2f0; border-color: #ffffff; color: #0b0b0c; box-shadow: 0 0 18px rgba(154, 154, 154, .25); }
.inv-chip[data-empty]:not([aria-pressed="true"]) { color: var(--inv-ink-dim); border-color: #333333; background: rgba(33, 33, 33, .55); }
.inv-chip-count { min-width: 20px; padding: 2px 6px; border-radius: 999px; background: rgba(255, 255, 255, .08); font-size: 10px; font-variant-numeric: tabular-nums; text-align: center; }
.inv-chip-count:empty { display: none; }

/* Section heads ------------------------------------------------------------------ */
.inv-section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 6px 18px; margin: 0 0 14px; }
body[data-page="inventory"] .inv-section-head h2 { margin: 0; font-size: clamp(28px, 7vw, 42px); line-height: .92; letter-spacing: -.045em; }
body.portal[data-page="inventory"] .inv-section-head .status { max-width: none; margin: 0; color: var(--inv-ink-dim); font-size: 13px; text-align: left; }
.inv-section-lede { max-width: 60ch; margin: 8px 0 0; color: var(--inv-ink-soft); font-size: 14px; line-height: 1.55; }

/* Item tiles: the Wardrobe tile, with collection, rarity and actions ------------- */
/* Tiles keep their own height (align-items: start): a short tile never stretches to its tallest neighbour. */
body.portal[data-page="inventory"] .inv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 12px; max-width: none; margin: 0; }
.inv-tile { --tone: var(--rarity-common); position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid color-mix(in srgb, var(--tone) 40%, #424242); border-radius: 12px; background: var(--inv-tile); color: #f5f5f5; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.inv-tile[data-tone="uncommon"] { --tone: var(--rarity-uncommon); }
.inv-tile[data-tone="rare"] { --tone: var(--rarity-rare); }
.inv-tile[data-tone="very-rare"] { --tone: var(--rarity-very-rare); }
.inv-tile[data-tone="epic"] { --tone: var(--rarity-epic); }
.inv-tile[data-tone="legendary"] { --tone: var(--rarity-legendary); }
.inv-tile[data-tone="mythic"] { --tone: var(--rarity-mythic); }
.inv-tile[data-tone="super-rare"] { --tone: var(--rarity-super-rare); }
.inv-tile[data-tone="unclaimed"] { --tone: #d7cf8a; border-style: dashed; }
.inv-tile::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--tone); pointer-events: none; }
.inv-tile:hover, .inv-tile:focus-within { transform: translateY(-3px); border-color: var(--tone); box-shadow: 0 10px 28px color-mix(in srgb, var(--tone) 28%, transparent); }
.inv-tile-media { position: relative; }
.inv-tile-art { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1; margin: 0; padding: 0; overflow: hidden; border: 0; border-radius: 0; background: radial-gradient(70% 70% at 50% 60%, color-mix(in srgb, var(--tone) 22%, #101010), #101010); color: inherit; font: inherit; }
button.inv-tile-art { cursor: zoom-in; }
/* Drawn inside the button: .inv-tile clips anything outside it. Needs the page prefix to
   beat the general focus rule above. */
body[data-page="inventory"] button.inv-tile-art:focus-visible { outline: 3px solid #ffffff; outline-offset: -3px; }
.inv-tile-art img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s var(--inv-ease); }
button.inv-tile-art:hover img { transform: scale(1.05); }
.inv-tile-placeholder { padding: 16px; color: var(--inv-ink-dim); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-align: center; text-transform: uppercase; }
.inv-tile-3d { position: absolute; right: 8px; bottom: 8px; padding: 4px 8px; border: 1px solid rgba(154, 154, 154, .5); border-radius: 999px; background: rgba(12, 12, 12, .85); color: #e2e2e2; font-size: 9px; font-weight: 800; letter-spacing: .12em; transition: background-color .2s ease, border-color .2s ease; }
button.inv-tile-art:hover .inv-tile-3d { background: rgba(154, 154, 154, .3); border-color: #bcbcbc; }
.inv-tile-badge { position: absolute; top: 8px; left: 8px; padding: 4px 8px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 999px; background: rgba(12, 12, 12, .82); color: #f0f0f0; font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; pointer-events: none; }
.inv-tile.is-unclaimed .inv-tile-badge { border-color: #d7cf8a; background: #d7cf8a; color: #1d231e; }
/* A compact info block under the square art: collection, name, then rarity and token share a line;
   notes and the action row take a full line each. */
.inv-tile-body { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px; min-width: 0; padding: 9px 9px 12px; }
.inv-tile-body > * { flex: 1 1 100%; min-width: 0; margin: 0; }
.inv-tile-body > :is(.inv-tile-rarity, .inv-tile-token) { flex: 0 1 auto; }
.inv-tile-collection { color: var(--inv-ink-dim); font-size: 9px; font-weight: 800; letter-spacing: .12em; line-height: 1.3; text-transform: uppercase; overflow-wrap: anywhere; }
body[data-page="inventory"] .inv-tile h3 { margin: 0; font-size: 13px; line-height: 1.18; letter-spacing: -.01em; overflow-wrap: anywhere; }
.inv-tile-rarity { display: inline-flex; align-items: center; gap: 6px; color: color-mix(in srgb, var(--tone) 70%, #fff); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.inv-tile-rarity::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 8px var(--tone); }
.inv-tile-note { color: var(--inv-ink-soft); font-size: 11px; line-height: 1.4; }
.inv-tile-token { color: var(--inv-ink-dim); font-size: 10px; font-variant-numeric: tabular-nums; letter-spacing: .02em; overflow-wrap: anywhere; }
/* One row: the first action takes the free width, the others are 44px squares (Sell, the metadata
   icon). A lone action keeps its long label; in a shared row each shows its short one. No action
   ever goes under 44px: a tile too narrow for three (a 360px phone or smaller) wraps the row, the
   first action keeps the top line and the others share the second (the 1000:1 grow keeps them
   square on a single line and lets them fill a wrapped one). */
body[data-page="inventory"] .inv-tile-body > .inv-tile-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; container-type: inline-size; }
.inv-tile-actions > .inv-tile-link { flex: 1 0 44px; min-width: 44px; padding: 8px 4px; }
.inv-tile-actions > .inv-tile-link:first-child { flex: 1000 1 44px; }
@container (width < 142px) { .inv-tile-actions:has(> :nth-child(3)) > .inv-tile-link:first-child { flex-basis: 100%; } }
.inv-tile-link-short { display: none; }
.inv-tile-link:not(:only-child) .inv-tile-link-short { display: inline; }
.inv-tile-link:not(:only-child) .inv-tile-link-long { display: none; }
/* The short Equip keeps the long label's arrow wherever the row leaves it room ("EQUIP ↗" needs
   about 53px): it drops only on a three-action row 142-151px wide (phones about 368-387px wide,
   such as 375) and on rows narrower than any real tile. */
.inv-tile-link-arrow { margin-left: .3em; }
@container (142px <= width < 152px) { .inv-tile-actions:has(> :nth-child(3)) .inv-tile-link-arrow { display: none; } }
@container (width < 103px) { .inv-tile-link-arrow { display: none; } }
.inv-tile-link .inv-icon { width: 16px; height: 16px; }
.inv-tile-link { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 44px; padding: 8px 6px; border: 1px solid var(--inv-line); border-radius: 9px; background: rgba(255, 255, 255, .02); color: #e2e2e2; font-size: 10px; font-weight: 800; letter-spacing: .04em; line-height: 1.25; text-align: center; text-transform: uppercase; transition: background-color .18s ease, border-color .18s ease, color .18s ease; }
.inv-tile-link:hover { border-color: var(--inv-blue); background: rgba(154, 154, 154, .1); color: #fff; }
.inv-tile-link.is-primary { border-color: rgba(154, 154, 154, .55); background: rgba(154, 154, 154, .12); color: #eeeeee; }
.inv-tile-link.is-primary:hover { background: rgba(154, 154, 154, .24); border-color: #bcbcbc; }

/* Loading skeleton, empty and error states ---------------------------------------- */
.inv-skeleton { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.inv-skeleton span { display: block; aspect-ratio: .68; border: 1px solid var(--inv-line); border-radius: 12px; background: linear-gradient(90deg, #1a1a1a 0%, #262626 50%, #1a1a1a 100%); background-size: 200% 100%; }
.inv-skeleton span:nth-child(n+3) { display: none; }
body.portal[data-page="inventory"] .inv-empty { grid-column: 1 / -1; display: grid; justify-items: center; gap: 10px; width: 100%; max-width: 640px; margin: 8px auto; padding: 40px 22px; border: 1px solid var(--inv-line); border-radius: 18px; background: radial-gradient(ellipse at 50% 0%, #373737, var(--inv-navy-deep) 70%); color: var(--inv-ink-soft); text-align: center; }
body[data-page="inventory"] .inv-empty h3 { margin: 0; color: #fff; font-size: clamp(22px, 6vw, 30px); }
body[data-page="inventory"] .inv-empty p { max-width: 44ch; margin: 0 0 6px; color: var(--inv-ink-soft); font-size: 14px; line-height: 1.6; }
.inv-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
body.portal[data-page="inventory"] .inv-empty.is-error { border-color: rgba(255, 77, 109, .45); background: radial-gradient(ellipse at 50% 0%, rgba(255, 77, 109, .16), var(--inv-navy-deep) 70%); }

/* Sealed crates: a highlighted band around the crates.js surface ------------------- */
.inv-crates { position: relative; isolation: isolate; margin: 36px 0 0; padding: 20px 14px 10px; scroll-margin-top: 20px; border: 1px solid transparent; border-radius: 20px; background: radial-gradient(90% 60% at 0% 0%, rgba(142, 142, 142, .18), transparent 60%), linear-gradient(#151515, #151515) padding-box, linear-gradient(135deg, rgba(167, 167, 167, .7), rgba(154, 154, 154, .3) 50%, rgba(142, 142, 142, .16)) border-box; box-shadow: 0 24px 60px rgba(0, 0, 0, .32); transition: box-shadow .3s ease; }
.inv-crates.has-crates { box-shadow: 0 24px 60px rgba(0, 0, 0, .32), 0 0 60px rgba(142, 142, 142, .22); }
body[data-page="inventory"] .inv-crates .inv-crates-eyebrow { color: #b8b8b8; }
body[data-page="inventory"] .inv-crates > .inv-section-head { margin-bottom: 6px; }
body[data-page="inventory"] #crate-app { margin-top: 12px; }
body[data-page="inventory"] #crate-app h3 { font-size: 20px; font-weight: 800; letter-spacing: -.03em; text-transform: uppercase; }
/* The band already carries the "Sealed crates" h2, so the crates.js panel title reads as a sub-label. */
body[data-page="inventory"] #crate-app .crate-app-head h3 { color: var(--inv-ink-soft); font-size: 13px; letter-spacing: .1em; }
body[data-page="inventory"] #crate-app h4 { font-size: 15px; font-weight: 800; letter-spacing: -.01em; text-transform: uppercase; }
body[data-page="inventory"] #crate-app .crate-app-head { flex-wrap: wrap; gap: 12px; }
body[data-page="inventory"] #crate-app :is(.crate-service-status, .crate-owned-status, .crate-inventory-intro) { color: var(--inv-ink-soft); }
body[data-page="inventory"] #crate-app .crate-inventory-intro { margin: 12px 0; }
/* The band intro above already explains crates; the crates.js intro would repeat it. */
body[data-page="inventory"] #crate-app .crate-inventory-intro { display: none; }
body[data-page="inventory"] #crate-app .crate-app-head + .crate-inventory-intro + .button { margin: 12px 0 4px; }
body[data-page="inventory"] #crate-app .crate-inventory-intro + .button { margin-bottom: 4px; }
body[data-page="inventory"] #crate-app .crate-owned { margin-top: 20px; padding-top: 20px; border-top-color: var(--inv-line); }
body[data-page="inventory"] #crate-app .crate-owned-heading > span { color: var(--inv-ink-dim); }
body[data-page="inventory"] #crate-app .crate-owned-status:has(+ .crate-owned-grid:empty) { display: flex; align-items: center; gap: 12px; margin: 14px 0 0; padding: 18px 16px; border: 1px dashed var(--inv-line-strong); border-radius: 14px; background: rgba(19, 19, 19, .6); }
body[data-page="inventory"] #crate-app .crate-owned-status:has(+ .crate-owned-grid:empty)::before { content: ''; flex: none; width: 36px; height: 36px; border-radius: 10px; background: rgba(142, 142, 142, .16) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b9afff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m12 3 8 4.5v9L12 21l-8-4.5v-9L12 3Z'/%3E%3Cpath d='m4 7.5 8 4.5 8-4.5M12 12v9'/%3E%3C/svg%3E") center / 20px no-repeat; }
body[data-page="inventory"] #crate-app .crate-owned-grid:not(:empty) { margin-top: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 12px; }
body[data-page="inventory"] #crate-app .crate-owned-card { --tone: var(--rarity-common); position: relative; overflow: hidden; gap: 12px; padding: 12px 12px 16px; border: 1px solid color-mix(in srgb, var(--tone) 45%, #424242); border-radius: 14px; background: var(--inv-tile); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
body[data-page="inventory"] #crate-app .crate-owned-card::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--tone); }
body[data-page="inventory"] #crate-app .crate-owned-card:has(.crate-rarity[data-rarity="uncommon"]) { --tone: var(--rarity-uncommon); }
body[data-page="inventory"] #crate-app .crate-owned-card:has(.crate-rarity[data-rarity="rare"]) { --tone: var(--rarity-rare); }
body[data-page="inventory"] #crate-app .crate-owned-card:has(.crate-rarity[data-rarity="very-rare"]) { --tone: var(--rarity-very-rare); }
body[data-page="inventory"] #crate-app .crate-owned-card:has(.crate-rarity[data-rarity="epic"]) { --tone: var(--rarity-epic); }
body[data-page="inventory"] #crate-app .crate-owned-card:has(.crate-rarity[data-rarity="legendary"]) { --tone: var(--rarity-legendary); }
body[data-page="inventory"] #crate-app .crate-owned-card:has(.crate-rarity[data-rarity="mythic"]) { --tone: var(--rarity-mythic); }
body[data-page="inventory"] #crate-app .crate-owned-card:has(.crate-rarity[data-rarity="super-rare"]) { --tone: var(--rarity-super-rare); }
body[data-page="inventory"] #crate-app .crate-owned-card:hover, body[data-page="inventory"] #crate-app .crate-owned-card:focus-within { transform: translateY(-3px); border-color: var(--tone); box-shadow: 0 12px 30px color-mix(in srgb, var(--tone) 28%, transparent); }
body[data-page="inventory"] #crate-app .crate-owned-art { min-height: 0; aspect-ratio: 1; border-radius: 10px; background: radial-gradient(70% 70% at 50% 60%, color-mix(in srgb, var(--tone) 24%, #101010), #101010); }
body[data-page="inventory"] #crate-app .crate-owned-art img { height: 100%; }
body[data-page="inventory"] #crate-app .crate-openings > h4 { margin: 22px 0 8px; }
body[data-page="inventory"] #crate-app .crate-recorded { flex-wrap: wrap; gap: 10px 16px; padding: 14px 0; border-bottom-color: var(--inv-line); }
body[data-page="inventory"] #crate-app .crate-recorded span { color: var(--inv-ink-soft); }
body[data-page="inventory"] #crate-app .crate-pending-request { border-radius: 14px; }

/* Phones: three stat cards are about 96px wide, so the icon sits above a tighter label. */
@media (max-width: 479px) {
  .inv-stat { padding: 12px 8px; }
  .inv-stat dt { flex-direction: column; gap: 6px; min-height: 0; letter-spacing: .05em; }
}

@media (min-width: 480px) {
  .inv-hero { padding: 26px 24px 22px; }
  .inv-hero-actions .button { flex: 0 0 auto; padding-left: 18px; padding-right: 18px; }
  .inv-stat { padding: 14px; }
  .inv-stat dt { min-height: 0; align-items: center; font-size: 10px; }
  .inv-crates { padding: 24px 20px 14px; }
}

/* Side rail from 751px: tiles grow to a comfortable width. */
@media (min-width: 751px) {
  body.portal[data-page="inventory"] .inv-grid, .inv-skeleton { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
  .inv-skeleton span:nth-child(n+3) { display: block; }
}

/* Wider screens: roomier hero and toolbar on one row. */
@media (min-width: 980px) {
  .inv-hero { padding: 30px 30px 24px; }
  .inv-search { flex: 0 1 460px; }
  .inv-crates { padding: 30px 28px 18px; margin-top: 44px; }
}

/* Wide: copy + a fanned shelf of the rarest owned pieces, summary underneath. */
@media (min-width: 1180px) {
  .inv-hero { grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 36px 36px 28px; }
  body[data-page="inventory"] .inv-hero h1 { font-size: clamp(64px, 6vw, 88px); }
  .inv-summary { grid-column: 1 / -1; }
  .inv-shelf { display: flex; align-items: flex-end; padding: 0 12px 0 0; }
  .inv-shelf-item { --tone: var(--rarity-common); display: block; flex: none; width: clamp(104px, 9vw, 136px); aspect-ratio: 1; overflow: hidden; border: 1px solid color-mix(in srgb, var(--tone) 55%, #424242); border-radius: 14px; background: radial-gradient(70% 70% at 50% 60%, color-mix(in srgb, var(--tone) 26%, #101010), #101010); box-shadow: 0 16px 34px rgba(0, 0, 0, .4), 0 0 26px color-mix(in srgb, var(--tone) 24%, transparent); }
  .inv-shelf-item + .inv-shelf-item { margin-left: -18px; }
  .inv-shelf-item:nth-child(1) { transform: rotate(-6deg) translateY(6px); z-index: 1; }
  .inv-shelf-item:nth-child(2) { transform: translateY(-10px) scale(1.08); z-index: 2; }
  .inv-shelf-item:nth-child(3) { transform: rotate(6deg) translateY(6px); z-index: 1; }
  .inv-shelf-item[data-tone="uncommon"] { --tone: var(--rarity-uncommon); }
  .inv-shelf-item[data-tone="rare"] { --tone: var(--rarity-rare); }
  .inv-shelf-item[data-tone="very-rare"] { --tone: var(--rarity-very-rare); }
  .inv-shelf-item[data-tone="epic"] { --tone: var(--rarity-epic); }
  .inv-shelf-item[data-tone="legendary"] { --tone: var(--rarity-legendary); }
  .inv-shelf-item[data-tone="mythic"] { --tone: var(--rarity-mythic); }
  .inv-shelf-item[data-tone="super-rare"] { --tone: var(--rarity-super-rare); }
  .inv-shelf-item img { width: 100%; height: 100%; object-fit: contain; }
  .inv-summary { grid-template-columns: repeat(3, minmax(0, 220px)); }
  body.portal[data-page="inventory"] .inv-grid, .inv-skeleton { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
}

@media (prefers-reduced-motion: no-preference) {
  .inv-skeleton span { animation: inv-shimmer 1.4s ease-in-out infinite; }
  @keyframes inv-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
}
@media (prefers-reduced-motion: reduce) {
  body[data-page="inventory"] *, body[data-page="inventory"] *::before, body[data-page="inventory"] *::after { transition: none !important; }
  .inv-tile:hover, .inv-tile:focus-within, body[data-page="inventory"] #crate-app .crate-owned-card:hover, body[data-page="inventory"] .button.filled:hover { transform: none; }
  button.inv-tile-art:hover img { transform: none; }
}

/* Social Circle pieces (SERVER-DONE.md §9): a second badge names the NFT the piece follows; the note says it is not for sale. */
.inv-tile-badge-circle { top: 36px; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-color: rgba(255, 255, 255, .28); background: rgba(242, 242, 240, .92); color: #0b0b0c; }
.inv-tile-follows { color: var(--inv-ink-dim); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: 10px; }
.inv-tile[data-source="social_circle"] .inv-tile-media { outline: 1px solid rgba(255, 255, 255, .12); outline-offset: -1px; }
