/*
 * inventory.css — Inventory page (route /inventory, js/pages/inventory.js).
 * 2026-09-10 redesign from a reference screenshot: left icon category rail
 * + middle grid of rarity-framed square cards + right detail panel.
 * 2026-09-11 polish pass: framed rail categories, prettier search pill,
 * softer hover/select, bigger selected-item art, hidden scrollbars, and a
 * progressive "whole frame" treatment for grades A+ (see [data-tier]).
 * Classes `inv2-*`. DEEPCORE amber/cream palette.
 */

.inv2-wrap {
    position: relative; z-index: 2; flex: 1; min-height: 0;
    display: flex; align-items: stretch; gap: 14px; padding: 14px 18px;
}

/* ── Left category rail ────────────────────────────────────────────── */
.inv2-rail {
    flex: 0 0 148px; display: flex; flex-direction: column; min-height: 0;
    background: rgba(255,248,236,.5);
    border: 1px solid rgba(58,36,16,.16); border-radius: 14px;
    padding: 12px 11px;
}
.inv2-rail-head {
    font-size: 10.5px; font-weight: 800; letter-spacing: 1.5px; color: #8a6a48;
    padding: 2px 4px 10px;
}
.inv2-rail-list { flex: 1; overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none; display: flex; flex-direction: column; gap: 8px; }
.inv2-rail-list::-webkit-scrollbar { display: none; }

/* Each category is its own framed tile now (not just a fill on the active one). */
.inv2-rail-item {
    position: relative; display: flex; align-items: center; gap: 9px;
    cursor: pointer; text-align: left;
    padding: 13px 11px; border-radius: 12px; color: #6b4520;
    background: linear-gradient(180deg,#fffdf8,#f9f1e4);
    border: 1.5px solid rgba(58,36,16,.16);
    box-shadow: 0 1px 3px rgba(58,36,16,.06);
    transition: border-color .16s, background .16s, transform .12s, box-shadow .16s;
}
.inv2-rail-item:hover { border-color: rgba(200,100,26,.4); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(58,36,16,.12); }
.inv2-rail-item.active {
    color: #fff8ec; border-color: #e08838;
    background: linear-gradient(180deg,#f0883e,#c8641a);
    box-shadow: 0 5px 16px rgba(200,100,26,.4);
}
.inv2-rail-ic { font-size: 18px; flex-shrink: 0; }
.inv2-rail-lbl { font-size: 12.5px; font-weight: 800; letter-spacing: .3px; flex: 1; min-width: 0; }
.inv2-rail-n {
    font-size: 9px; font-weight: 800; font-family: var(--font-mono);
    background: rgba(58,36,16,.12); color: #6b4520;
    min-width: 17px; height: 17px; line-height: 17px; text-align: center;
    border-radius: 999px; padding: 0 4px; flex-shrink: 0;
}
.inv2-rail-item.active .inv2-rail-n { background: rgba(255,255,255,.3); color: #fff8ec; }

.inv2-rail-foot { padding-top: 12px; margin-top: 10px; border-top: 1px solid rgba(58,36,16,.14); }
.inv2-fuse-btn {
    width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px;
    border: 1.5px solid rgba(200,100,26,.4); background: rgba(200,100,26,.1); color: #a3521a;
    font-size: 11.5px; font-weight: 800; letter-spacing: 1px; cursor: pointer;
    padding: 11px 6px; border-radius: 11px; transition: background .14s, border-color .14s;
}
.inv2-fuse-btn:hover { background: rgba(200,100,26,.2); border-color: rgba(200,100,26,.6); }
.inv2-fuse-ic { font-size: 13px; }

/* ── Middle: toolbar + grid ────────────────────────────────────────── */
.inv2-mid { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.inv2-toolbar { flex-shrink: 0; display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }

.inv2-search-wrap { flex: 1; min-width: 0; position: relative; display: flex; align-items: center; }
.inv2-search-ic { position: absolute; left: 15px; font-size: 12px; opacity: .55; pointer-events: none; }
.inv2-search {
    width: 100%; padding: 11px 16px 11px 39px; border-radius: 999px;
    border: 1.5px solid rgba(58,36,16,.14);
    background: linear-gradient(180deg,#fffdf8,#f8efdf);
    box-shadow: inset 0 1px 3px rgba(58,36,16,.1);
    font: inherit; font-size: 12px; color: #2c1a08;
    transition: border-color .16s, box-shadow .16s;
}
.inv2-search::placeholder { color: rgba(138,106,72,.5); }
.inv2-search:focus {
    outline: none; border-color: #e08838;
    box-shadow: inset 0 1px 2px rgba(58,36,16,.05), 0 0 0 3px rgba(240,136,62,.2);
}
.inv2-grade {
    flex: 0 0 128px; padding: 11px 14px; border-radius: 999px; cursor: pointer;
    border: 1.5px solid rgba(58,36,16,.14); background: linear-gradient(180deg,#fffdf8,#f8efdf);
    box-shadow: inset 0 1px 3px rgba(58,36,16,.1);
    font: inherit; font-size: 12px; color: #2c1a08;
}
.inv2-grade:focus { outline: none; border-color: #e08838; }
.inv2-count { flex-shrink: 0; font-size: 11px; color: #8a6a48; font-family: var(--font-mono); white-space: nowrap; }

.inv2-grid {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    scrollbar-width: none; -ms-overflow-style: none;
    /* `align-items: start` + a fixed `grid-auto-rows` (not `aspect-ratio` on
       the card) is deliberate — Chromium can size an `aspect-ratio` grid
       item taller than its row when the item is (default) `stretch`ed,
       which made cards creep into the row below and look "tumpang tindih"
       (reported by the user on the Tiket tab). Fixed row height sidesteps
       the whole class of bug. */
    align-content: start; align-items: start;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    grid-auto-rows: 132px;
    gap: 15px;
    padding: 4px 2px 8px;
}
.inv2-grid::-webkit-scrollbar { display: none; }

.inv2-card {
    position: relative; height: 132px; cursor: pointer;
    border: 2.5px solid var(--fc, #8a6a48); border-radius: 16px;
    background: linear-gradient(158deg, #fffdf8, color-mix(in srgb, var(--fc, #8a6a48) 13%, #fffdf8));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.55), inset 0 -12px 18px rgba(58,36,16,.05);
    overflow: hidden;
    transition: transform .2s cubic-bezier(.2,1,.32,1), box-shadow .2s ease, border-color .2s ease;
}
.inv2-card:hover {
    transform: translateY(-4px) scale(1.035);
    border-color: color-mix(in srgb, var(--fc, #c8641a) 78%, #fff);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.6), 0 12px 24px rgba(58,36,16,.22), 0 0 14px color-mix(in srgb, var(--fc, #c8641a) 30%, transparent);
}
.inv2-card.sel {
    border-color: color-mix(in srgb, var(--fc, #c8641a) 92%, #fff);
    animation: inv2-sel 2.6s ease-in-out infinite;
}
@keyframes inv2-sel {
    0%, 100% { box-shadow: inset 0 0 0 1px rgba(255,255,255,.6), 0 0 0 4px color-mix(in srgb, var(--fc, #c8641a) 20%, transparent), 0 10px 22px rgba(58,36,16,.2); }
    50%      { box-shadow: inset 0 0 0 1px rgba(255,255,255,.6), 0 0 0 7px color-mix(in srgb, var(--fc, #c8641a) 34%, transparent), 0 12px 28px rgba(58,36,16,.28); }
}

.inv2-card-art {
    position: absolute; inset: 15% 13% 17% 13%;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; line-height: 1;
}
.inv2-card-art img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }

.inv2-card-g {
    position: absolute; top: 0; left: 0; z-index: 3;
    font-size: 9px; font-weight: 900; color: #fff8ec; letter-spacing: .3px;
    padding: 2px 7px 3px 5px; border-radius: 0 0 9px 0;
    box-shadow: 1px 1px 3px rgba(0,0,0,.22);
}
.inv2-card-used {
    position: absolute; top: 4px; right: 5px; z-index: 3; font-size: 12.5px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.35));
}
.inv2-card-qty {
    position: absolute; right: 5px; bottom: 5px; z-index: 3;
    font-size: 11.5px; font-weight: 900; font-family: var(--font-mono); color: #2c1a08;
    background: rgba(255,253,248,.94); border: 1px solid rgba(58,36,16,.2);
    border-radius: 7px; padding: 1px 5px; min-width: 17px; text-align: center;
    box-shadow: 0 1px 3px rgba(58,36,16,.15);
}

/* ── High-grade "whole frame" treatment (grades A+; see RARE_TIER in JS) ── */
.inv2-card[data-tier] {
    background: linear-gradient(158deg, #fffdf8, color-mix(in srgb, var(--fc) 22%, #fffdf8));
}
.inv2-card[data-tier="hi"]  { box-shadow: inset 0 0 0 1px rgba(255,255,255,.55), inset 0 0 16px color-mix(in srgb, var(--fc) 26%, transparent), 0 0 12px color-mix(in srgb, var(--fc) 35%, transparent); }
.inv2-card[data-tier="top"] { box-shadow: inset 0 0 0 1px rgba(255,255,255,.55), inset 0 0 20px color-mix(in srgb, var(--fc) 34%, transparent), 0 0 18px color-mix(in srgb, var(--fc) 5%, transparent); }

/* Animated gradient border for the very top grades (L / M* / U). Rendered
   fully inside the card bounds via the mask trick, so a scrollable grid
   never clips it. */
.inv2-card[data-tier="top"]::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 2.5px; pointer-events: none;
    background: conic-gradient(from 0deg, var(--fc), color-mix(in srgb, var(--fc) 15%, #fff), var(--fc), color-mix(in srgb, var(--fc) 15%, #fff), var(--fc));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    animation: inv2-spin 3.2s linear infinite;
}
@keyframes inv2-spin { to { transform: rotate(1turn); } }

/* Diagonal light sweep for any rare tier. */
.inv2-card-shine { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; z-index: 2; }
.inv2-card-shine::before {
    content: ""; position: absolute; top: -60%; left: -70%; width: 45%; height: 220%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.5), transparent);
    transform: rotate(18deg);
    animation: inv2-sweep 4s ease-in-out infinite;
}
.inv2-card[data-tier="top"] .inv2-card-shine::before { animation-duration: 3s; background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent); }
@keyframes inv2-sweep { 0%, 60% { left: -70%; } 100% { left: 135%; } }

/* ── Right detail panel ────────────────────────────────────────────── */
.inv2-detail {
    flex: 0 0 348px; display: flex; flex-direction: column; min-height: 0;
    background: rgba(255,248,236,.5);
    border: 1px solid rgba(58,36,16,.16); border-radius: 14px;
    padding: 14px; overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none;
}
.inv2-detail::-webkit-scrollbar { display: none; }
.inv2-detail-x { display: none; }

.inv2-detail-empty { margin: auto; text-align: center; color: rgba(138,106,72,.7); }
.inv2-detail-empty-ic { font-size: 42px; margin-bottom: 10px; }
.inv2-detail-empty p { font-size: 12.5px; }

.inv2-detail-card {
    position: relative; display: flex; flex-direction: column;
    background: #fffdf8; border: 1.5px solid rgba(58,36,16,.14); border-radius: 13px; overflow: hidden;
    transition: box-shadow .2s ease, border-color .2s ease;
}
.inv2-detail-card[data-tier="hi"]  { border-color: color-mix(in srgb, var(--fc) 55%, #fff); box-shadow: 0 0 20px color-mix(in srgb, var(--fc) 30%, transparent); }
.inv2-detail-card[data-tier="top"] {
    border-color: color-mix(in srgb, var(--fc) 75%, #fff);
    box-shadow: 0 0 28px color-mix(in srgb, var(--fc) 40%, transparent), inset 0 0 24px color-mix(in srgb, var(--fc) 12%, transparent);
}

.inv2-detail-head {
    background: linear-gradient(180deg,#3a2410,#2c1a08); color: #fff4e2;
    padding: 12px 15px;
}
.inv2-detail-name { font-size: 16px; font-weight: 800; letter-spacing: .3px; }

.inv2-detail-banner {
    position: relative; padding: 24px 14px 18px; overflow: hidden;
    background: linear-gradient(165deg, color-mix(in srgb, var(--fc,#c8641a) 44%, #f0f4ff), color-mix(in srgb, var(--fc,#c8641a) 12%, #fdfefe) 80%);
    display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.inv2-detail-banner::before {
    content: ""; position: absolute; left: 50%; top: 42%; width: 280px; height: 280px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, color-mix(in srgb, var(--fc,#c8641a) 40%, transparent), transparent 70%);
    pointer-events: none;
}
.inv2-detail-shine { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.inv2-detail-shine::before {
    content: ""; position: absolute; top: -40%; left: -60%; width: 40%; height: 180%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent);
    transform: rotate(16deg); animation: inv2-sweep 3.4s ease-in-out infinite;
}

.inv2-detail-art {
    position: relative; z-index: 2;
    width: 192px; height: 192px; display: flex; align-items: center; justify-content: center;
    font-size: 108px; line-height: 1;
    filter: drop-shadow(0 10px 22px color-mix(in srgb, var(--fc,#8a6a48) 45%, rgba(58,36,16,.3)));
}
.inv2-detail-art img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.inv2-detail-meta { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.inv2-detail-type { font-size: 10.5px; letter-spacing: 1.5px; font-weight: 800; color: #6b4520; opacity: .85; }
.inv2-detail-owned { font-size: 12.5px; color: #2c1a08; }
.inv2-detail-owned b { font-family: var(--font-mono); font-size: 16px; }
.inv2-detail-grade { font-size: 9px; font-weight: 900; color: #fff8ec; letter-spacing: .5px; padding: 3px 9px; border-radius: 999px; box-shadow: 0 1px 4px rgba(0,0,0,.2); }

.inv2-detail-body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 10px; }
.inv2-detail-set { font-size: 10.5px; letter-spacing: 1px; font-weight: 700; color: #8a6a48; }
.inv2-detail-desc { font-size: 12.5px; line-height: 1.65; color: #5a3f22; margin: 0; }

.inv2-detail-stats { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }
.inv2-detail-stats > div {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 11.5px; color: #8a6a48; padding: 6px 0; border-bottom: 1px solid rgba(58,36,16,.1);
}
.inv2-detail-stats b { font-family: var(--font-mono); font-weight: 800; color: #2c1a08; }
.inv2-detail-stats b.ok { color: #2b8a3e; }
.inv2-detail-stats b.used { color: #c8641a; }

.inv2-detail-cta {
    width: 100%; border: none; border-radius: 10px; cursor: pointer;
    background: linear-gradient(180deg,#f0883e,#c8641a); color: #fff8ec;
    font-size: 12.5px; font-weight: 800; letter-spacing: .8px; padding: 11px;
    box-shadow: 0 3px 10px rgba(200,100,26,.35);
}
.inv2-detail-cta:hover { filter: brightness(1.07); }

/* ── Responsive (kept as @container; never fires — #app is a fixed 1440 stage) ── */
@container (max-width: 1040px) {
    .inv2-detail {
        position: fixed; inset: 0; z-index: 400; flex: none;
        display: none; align-items: center; justify-content: center;
        background: rgba(20,10,4,.55); border: none; border-radius: 0; padding: 20px;
    }
    .inv2-detail.open { display: flex; }
    .inv2-detail-card { width: 100%; max-width: 360px; max-height: 86vh; overflow-y: auto; }
    .inv2-detail-x {
        display: flex; align-items: center; justify-content: center;
        position: fixed; top: 16px; right: 16px; z-index: 2;
        width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
        border: none; background: rgba(0,0,0,.4); color: #fff8ec; font-size: 13px;
    }
    .inv2-detail-empty { display: none; }
}
@container (max-width: 720px) {
    .inv2-wrap { flex-direction: column; padding: 10px 12px; gap: 10px; }
    .inv2-rail { flex: 0 0 auto; }
    .inv2-rail-list { flex-direction: row; overflow-x: auto; }
    .inv2-rail-item { flex: 0 0 auto; }
    .inv2-rail-head, .inv2-rail-foot { display: none; }
    .inv2-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
}
