#inv.show{
  --gold:#efd099;--ink:#e5e4eb;
  position:fixed;inset:0;isolation:isolate;display:grid;box-sizing:border-box;
  grid-template:76px minmax(0,1fr) 64px / clamp(54px,8vw,135px) minmax(0, 2.3fr) minmax(0,1fr);
  gap:clamp(12px,2.25vw,45px);padding:0 5.2vw 2vh 3.8vw;
  overflow:hidden;background:#181b2a;color:var(--ink);font:500 clamp(13px,1.25vw,21px)/1.35 'Source Sans 3','Segoe UI',sans-serif;
}
#inv.show::before{
  content:'';position:absolute;inset:-35px;z-index:-1;
  background:linear-gradient(145deg,#13151bc7,#1c1c32ba 72%,#45415b88),url('../assets/banners/standardscreen.png') center/cover;
  filter:blur(22px);
}
.inventory-header{grid-area:1/1/2/4;display:flex;align-items:center;justify-content:space-between;padding-left:2vw;gap:12px}
.inventory-header h1{font:600 clamp(17px,1.65vw,29px)/1.05 inherit;margin:0;font-size:clamp(17px,1.65vw,29px);font-weight:600}
.inventory-header h1 small{display:block;color:var(--gold);font-size:.7em;margin-bottom:4px}
.inventory-header>div{display:flex;align-items:center;gap:clamp(7px,1.2vw,20px)}
.inventory-wallet{display:flex;align-items:center;gap:6px;border:1px solid #e8ddbf50;background:#15151ccf;border-radius:20px;padding:0 12px 0 4px;font-variant-numeric:tabular-nums}
#inv [data-inventory-back]{padding:0;background:none;border:0;color:white;box-shadow:none;transform:none;width:38px;height:38px;display:grid;place-items:center}
.inventory-header button svg,.inventory-categories svg{width:65%;height:65%;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linejoin:round;stroke-linecap:round}
.inventory-categories{grid-area:2/1/4/2;display:flex;flex-direction:column;align-items:center;gap:clamp(15px,6vh,62px);position:relative;padding-top:5px}
.inventory-categories::before{content:'';position:absolute;inset:0 50%;width:1px;background:linear-gradient(#ced1dc50,#ced1dc18)}
#inv .inventory-categories button{position:relative;display:grid;place-items:center;width:clamp(34px,4.1vw,62px);aspect-ratio:1;border:0;border-radius:50%;padding:0;color:#d6d6df;background:#222431;box-shadow:none;transform:none}
#inv .inventory-categories button[aria-pressed=true]{color:#171923;background:#e8e8ef;outline:2px dotted #e8e8ef85;outline-offset:5px}
.inventory-grid{grid-area:2/2;min-height:0;display:grid;grid-template-columns:repeat(8,minmax(0,1fr));align-content:start;gap:clamp(6px,.7vw,13px);overflow:auto;padding:5px 9px 15px 5px;scrollbar-width:thin;scrollbar-color:#dddae6a8 transparent}
.inventory-r5{--rim:#c5a068;--tile-top:#875c5c;--tile-bottom:#cba76b}
.inventory-r4{--rim:#ad88d5;--tile-top:#3c405e;--tile-bottom:#8261b2}
.inventory-r3{--rim:#6f9fca;--tile-top:#394468;--tile-bottom:#527fb0}
#inv .inventory-grid button{position:relative;display:grid;min-width:0;padding:0;background:#202126;border:1px solid #ffffff24;border-bottom:2px solid var(--rim);border-radius:2px 16px 1px 1px;overflow:hidden;box-shadow:none;transform:none;color:white;cursor:pointer;text-shadow:none}
#inv .inventory-grid button[aria-pressed=true]{outline:2px solid white;outline-offset:1px;box-shadow:0 0 9px #ffedbda8}
.inventory-card-art,.inventory-art{position:relative;background:radial-gradient(ellipse at 54% 80%,#ffffff26,transparent 68%),linear-gradient(150deg,var(--tile-top),var(--tile-bottom));overflow:hidden}
.inventory-card-art{display:grid;place-items:center;aspect-ratio:1.04}
.inventory-card-art::before,.inventory-art::before{content:'';position:absolute;inset:3px;border:1px solid #fff2;border-radius:inherit;pointer-events:none}
.inventory-card-art>svg,.inventory-card-art>img{width:94%;height:89%;object-fit:contain;filter:drop-shadow(2px 4px 4px #0008)}
.inventory-card-art>img{position:absolute;height:165%;width:122%;max-width:none;top:0;object-position:center top}
.inventory-stars{position:absolute;bottom:-2px;left:0;right:0;text-align:center;letter-spacing:-.12em;color:#ffe3a0;text-shadow:0 1px 2px #815523;font-size:clamp(9px,1.15vw,22px)}
.inventory-grid button>small{padding:1px 0;text-align:center;font:600 clamp(10px,1.05vw,18px)/1.18 'Segoe UI',sans-serif;white-space:nowrap}
.unowned .inventory-card-art,.inventory-detail.unowned .inventory-art{filter:grayscale(1) brightness(.65)}
.inventory-detail{grid-area:2/3;min-height:0;overflow:auto;border-left:2px solid #d9d9e14f;padding:7px 0 12px clamp(14px,2.3vw,45px);scrollbar-width:thin}
.inventory-detail h2{margin:0 0 20px;color:var(--gold);border-bottom:3px solid #b9986b;padding-bottom:7px;font-size:clamp(18px,1.85vw,34px);font-weight:600;line-height:1.15}
.inventory-art{min-height:120px;aspect-ratio:2.55;color:#fff4df}
.inventory-art::before{inset:0;border:0;background:repeating-radial-gradient(circle at 48% 73%,transparent 0 24px,#ffffff17 25px 26px,transparent 28px 36px)}
.inventory-art>span,.inventory-detail-meta{position:absolute;z-index:1;left:4%;text-shadow:0 1px 3px #1b192b}
.inventory-art>span{top:7%}
.inventory-detail-meta{bottom:8%;font-weight:600}
.inventory-art>svg,.inventory-art>img{position:absolute;right:7%;top:2%;width:62%;height:96%;object-fit:contain;filter:drop-shadow(3px 6px 6px #1e18297a)}
.inventory-copy{margin-top:10px;padding:10px 11px;background:linear-gradient(110deg,#10121ec5,#191b2b40);color:#d8dae1}
.inventory-copy p{margin:0 0 8px}.inventory-copy p:last-child{margin-bottom:0}
.inventory-copy h3{margin:10px 0 3px;font-size:.87em;color:var(--gold)}
.inventory-lore{font-style:italic}
.inventory-atk{color:#ffa9a4}.inventory-def,.inventory-count{color:#b9ddff}.inventory-hp{color:#a6e5b1}.inventory-level,.inventory-bonus b{color:#f7d897}
.inventory-footer{grid-area:3/2;display:flex;align-items:center;gap:12px;font-size:.78em}
#inv .inventory-footer button{display:flex;justify-content:space-between;align-items:center;width:min(240px,60%);border:3px double #a7a7aa;border-radius:24px;background:#e8e8eb;color:#22252d;padding:5px 12px;box-shadow:none;transform:none;font:600 15px 'Segoe UI',sans-serif}
#inv button:focus-visible,.inventory-copy:focus-visible{outline:2px solid white;outline-offset:2px}
body[data-screen=inventory] #navToggle{display:none}
@media(max-width:1100px){.inventory-grid{grid-template-columns:repeat(6,minmax(0,1fr))}}
@media(max-width:700px){
 #inv.show{grid-template:62px minmax(0,1fr) 46px / 32px minmax(0,1.1fr) minmax(0,1fr);gap:7px;padding-inline:7px}
 .inventory-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
 .inventory-detail{padding-left:8px}
 .inventory-detail h2{margin-bottom:9px}
 .inventory-art>span{font-size:10px}
 .inventory-footer>span{display:none}
 .inventory-wallet{padding-inline:3px}
}

/* Relic details and shared reward tiles. */
.memory-tone-rare{--memory-tone:#8ccaff}
.memory-tone-epic{--memory-tone:#d3adff}
.memory-tone-legendary{--memory-tone:#ffe1a1}
.memory-tile{display:grid;min-width:0;overflow:hidden;border:1px solid #ffffff24;border-bottom:2px solid var(--rim);border-radius:2px 13px 1px 1px;background:#202126;color:#f4f3fa}
.memory-tile>small{display:block;min-width:0;padding:3px 2px;text-align:center;font:600 clamp(9px,1vw,15px)/1.2 'Source Sans 3','Segoe UI',sans-serif}
.memory-tile .inventory-card-art{width:100%}
.memory-tile.memory-claimed{opacity:.55}
.memory-artwork{position:relative;display:grid;place-items:center;width:100%;height:100%;min-width:0;min-height:0}
.memory-artwork>svg,.memory-artwork>img{position:absolute;inset:5%;width:90%;height:90%;object-fit:contain;filter:drop-shadow(2px 4px 4px #0008)}
.memory-artwork[data-ready=true]>svg{visibility:hidden}
.memory-detail h2{color:var(--memory-tone);border-bottom-color:var(--rim);margin-bottom:14px}
.memory-detail-hero{min-height:96px;aspect-ratio:2.5}
.inventory-art.memory-detail-hero>.memory-artwork{position:absolute;inset:2% 3% 2% auto;width:55%;height:96%}
.memory-detail-hero>.memory-artwork>img,.memory-detail-hero>.memory-artwork>svg{inset:0;width:100%;height:100%;object-position:right center}
.memory-relic-rarity{display:flex;align-items:center;gap:8px;font-weight:700;color:var(--memory-tone)}
.memory-relic-rarity i,.world-reward-rates i{display:inline-block;width:7px;height:7px;background:currentColor;transform:rotate(45deg);box-shadow:0 0 8px currentColor}
.memory-stat-block{margin-top:12px;background:#191b27ad;border:1px solid #d8d8ec25;padding:9px 10px 11px}
.memory-stat-block h3{margin:0 0 5px;color:#d6d7e7;font-size:.72em;letter-spacing:.13em;text-transform:uppercase}
.memory-stat-block ul{list-style:none;padding:0;margin:0}
.memory-stat-block ul+h3{margin-top:11px}
.memory-stat{--stat:#f1e6d6;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:7px;padding:5px 6px;color:var(--stat);background:#7980a117;border-bottom:1px solid #9ea0bf18;font-size:.84em}
.memory-stat:nth-child(even){background:#7980a12b}
.memory-stat-name{display:flex;align-items:center;gap:7px;line-height:1.12;overflow-wrap:anywhere}
.memory-stat-name svg{width:1.13em;height:1.13em;flex:none;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.memory-stat strong{justify-self:end;white-space:nowrap;font-variant-numeric:tabular-nums}

.memory-stat-hp{--stat:#a5e9b1}.memory-stat-atk{--stat:#ffa9a4}.memory-stat-def{--stat:#a9d8ff}
.memory-stat-critRate{--stat:#ffc985}.memory-stat-critDamage{--stat:#ffaca8}
.memory-stat-damageReduction{--stat:#a6e9df}.memory-stat-ki{--stat:#efcf89}.memory-stat-apRecovery{--stat:#c6bcff}
.memory-effect{margin-top:12px;padding:10px 11px;background:#151622bf;border-left:2px solid var(--rim);font-size:.85em}
.memory-effect small{color:#c7bdcb;font-size:.78em}.memory-effect h3{margin:4px 0;color:var(--memory-tone);font-size:1.07em}
.memory-effect p{margin:0;color:#e0dfe7;line-height:1.35}
.inventory-relic-empty{grid-column:1/-1;margin:12px 0;color:#e0dce9}
.adventure-memory-reward{display:flex;align-items:center;justify-content:center;gap:10px}
.adventure-memory-reward>.memory-artwork{width:56px;height:56px;flex:none}
.adventure-memory-reward>span:last-child{display:grid;text-align:left;color:var(--memory-tone)}
.adventure-results [data-memory-inventory]{margin-right:8px}
@media(max-width:700px){.memory-stat{gap:2px 5px}.memory-stat-block{padding:6px 4px}.memory-stat-name{gap:3px}}
.memory-stat-name>i{width:1.13em;flex:none;font-style:normal;text-align:center;font-size:1.15em}


.memory-stat .memory-roll-value{color:var(--memory-tone);text-shadow:0 0 8px color-mix(in srgb,var(--memory-tone) 66%,transparent)}
.memory-slot-emblem,.memory-tile-odds{position:absolute;z-index:2;top:4px;background:#181926ec;color:white;border:1px solid #e4e5ff48}
.memory-slot-emblem{left:4px;display:grid;place-items:center;width:clamp(12px,1.5vw,23px);aspect-ratio:1;border-radius:3px}
.memory-slot-emblem svg{width:78%;height:78%;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round}
.memory-tile-odds{right:4px;display:grid;gap:1px;padding:2px 4px;border-radius:3px;text-align:right;font:700 clamp(8px,.75vw,12px)/1.06 'Source Sans 3','Segoe UI',sans-serif}
.memory-tile-odds>span{display:flex;align-items:center;justify-content:flex-end;gap:3px;color:var(--memory-tone,#fff);font-variant-numeric:tabular-nums}
.memory-tile-odds i{width:4px;height:4px;background:currentColor;transform:rotate(45deg)}
.memory-tile-odds span:not([class]) i{display:none}
@media(max-width:700px){
 .memory-slot-emblem{left:2px;top:2px}
 .memory-tile-odds{right:2px;top:2px;padding:1px 2px}
 .memory-tile-odds>span{gap:2px}
 .memory-tile-odds i{width:3px;height:3px}
}
.inventory-art>.memory-artwork{position:absolute;inset:2% 4% 2% auto;width:60%;height:96%}

.memory-owner-label{display:inline-flex;gap:7px;align-items:center}
.memory-owner-face{display:inline-grid;place-items:center;flex:none;width:26px;height:26px;overflow:hidden;border:1px solid #debf79;border-radius:50%;background:#30344b}
.memory-owner-face img{width:100%;height:100%;object-fit:cover;object-position:center 19%}


/* Keep the artwork and caption inside the same fixed-ratio tile. */
#inv .inventory-grid{grid-auto-rows:max-content;align-items:start}
#inv .inventory-grid>button{
  --inv-caption:clamp(22px,2.8vh,29px);
  position:relative;display:block;box-sizing:border-box;
  width:100%;height:auto;min-width:0;min-height:0;aspect-ratio:1 / 1.12;
  overflow:hidden;padding:0;
}
#inv .inventory-grid>button>.inventory-card-art{
  position:absolute;inset:0 0 var(--inv-caption);width:auto;height:auto;
  min-height:0;min-width:0;overflow:hidden;aspect-ratio:auto;
}
#inv .inventory-grid>button>small{
  position:absolute;inset:auto 0 0;height:var(--inv-caption);box-sizing:border-box;
  display:flex;align-items:center;justify-content:center;gap:.18em;
  min-height:0;min-width:0;padding:0 2px;overflow:hidden;
  white-space:nowrap;background:#121319;color:#f6f1e9;
  line-height:1.12;font-size:clamp(9px,1vw,16px);z-index:2;
}
#inv .inventory-grid .inventory-stars{bottom:2%;pointer-events:none}

.inventory-bulk{width:min(680px,92vw);max-height:85vh;padding:22px;background:#151824;color:#fbedd5;border:1px solid #b69b6d;border-radius:10px;font:600 17px 'Segoe UI',sans-serif}
.inventory-bulk::backdrop{background:#090912ba;backdrop-filter:blur(6px)}
.inventory-bulk header,.inventory-bulk footer{display:flex;align-items:center;justify-content:space-between;gap:8px}
.inventory-bulk h2,.inventory-bulk p{margin:0 0 10px}
.inventory-bulk button{font:inherit;padding:7px 12px;transform:none;box-shadow:none;border:1px solid #a69068;border-radius:5px}
.inventory-bulk-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(218px,1fr));gap:6px;max-height:48vh;overflow:auto;scrollbar-width:none;margin-bottom:16px}
.inventory-bulk-list label{display:flex;align-items:center;gap:8px;padding:6px;border:1px solid #aea4bf33;background:#232737}
.inventory-bulk-list label:has(:checked){border-color:#ebc881;background:#372c30}
.inventory-bulk-list input{accent-color:#e3b460}
.inventory-bulk-list .memory-artwork{display:grid;flex:none;width:44px;height:44px}
.inventory-bulk-list small{display:block;color:#e6c389}
.inventory-bulk output{color:#f3cf87;font-size:14px}

.inventory-bulk{box-sizing:border-box;max-height:90dvh;overflow:auto;scrollbar-width:none}
.inventory-bulk-filters{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:10px 0 14px}
.inventory-bulk-filters label{display:grid;gap:4px;font-size:13px;color:#f0ce97}
.inventory-bulk-filters select{width:100%;min-width:0;padding:7px;border:1px solid #8f7b58;background:#222536;color:#fff3d8;border-radius:4px;font:inherit}
.inventory-bulk .inventory-bulk-list{grid-template-columns:repeat(auto-fit,minmax(min(100%,218px),1fr));max-height:44dvh}
.inventory-bulk-list label[hidden],.inventory-bulk-list p[hidden]{display:none}
.inventory-dismantle-confirm{width:min(580px,92vw)}
.inventory-dismantle-confirm ul{list-style:none;padding:0}
.inventory-dismantle-confirm li{display:flex;align-items:center;gap:8px;padding:6px;background:#232737;border:1px solid #aea4bf33}
.inventory-dismantle-confirm strong{color:#ffda8e;font-size:14px}
.inventory-bulk .inventory-dismantle-action{background:#754037;color:#fff0d8;border-color:#e7a68c}
.inventory-bulk footer{flex-wrap:wrap}
.inventory-bulk [role=status]:empty{display:none}
.inventory-bulk [role=status]{margin-top:8px;color:#ffad95}

.memory-reroll-dialog{width:min(610px,92vw)}
.memory-reroll-relic{display:flex;align-items:center;gap:10px;padding:7px 10px;background:#232637;border:1px solid #a494674d}
.memory-reroll-relic .memory-artwork{width:62px;height:62px}
.memory-reroll-relic small,.memory-reroll-dialog fieldset small{display:block;font-size:.78em;color:var(--memory-tone,#dcc9a5)}
.memory-reroll-dialog fieldset{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;margin:11px 0;padding:7px;border:1px solid #a4946773}
.memory-reroll-dialog fieldset label{display:flex;gap:7px;align-items:center;padding:7px;background:#282b3d;border:1px solid transparent}
.memory-reroll-dialog fieldset label:has(:checked){border-color:#e3c784;background:#493a2c}
.memory-reroll-dialog input{accent-color:#e3c784}
.memory-reroll-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,205px),1fr));gap:9px;margin:0 0 12px}
.memory-reroll-stats section{padding:6px 9px;border:1px solid #a6936b70;background:#1b2030}
.memory-reroll-stats h3{font-size:15px;margin:0 0 6px;color:#ffde9e}
.memory-reroll-stats ul{margin:0;padding:0;list-style:none}
.memory-reroll-dialog .memory-reroll-submit{background:#e5c785;color:#181623}
.memory-reroll-reveal{position:relative;overflow:hidden;animation:relic-roll-pop .48s ease-out both}
.memory-reroll-reveal::after{content:'';pointer-events:none;position:absolute;inset:0;background:linear-gradient(110deg,transparent 24%,#ffe9af99 50%,transparent 76%);animation:relic-roll-scan .65s ease-out both}
@keyframes relic-roll-pop{from{opacity:.38;transform:scale(.97);box-shadow:0 0 18px #ffd681}}
@keyframes relic-roll-scan{from{transform:translateX(-110%)}to{transform:translateX(110%)}}
@media(prefers-reduced-motion:reduce){.memory-reroll-reveal,.memory-reroll-reveal::after{animation:none}.memory-reroll-reveal::after{display:none}}
