/* The Inventory page's look, as a stylesheet: page frame, hero, filter panel, buttons, card grid,
   paginator and the "change user" dialog. A copy of the <style> block of webpages/inventory.js
   (which keeps its own), for the pages that share it: /generate and /agency. Keep the two in step.
   Onix / Ash: the --garam-c-* tokens and garam_dark.css restyle these same class names. */
/* Cookie-controlled Garam theme, blue by default. */
html:has(.garam-page), body:has(.garam-page) {
    background-color:var(--garam-theme-surface, #d2edfe) !important;
    background-image:none !important;
}
.garam-page { width:100%; min-height:100vh; box-sizing:border-box; padding:24px 16px 52px;
    color:var(--garam-c-123c5c, #123c5c); font-family:inherit; }
.garam-page *, .garam-modal *, .garam-owner-modal * { box-sizing:border-box; }
#garamGuestLanding[hidden], #garamInventoryMain[hidden],
#garamOwnerMineButton[hidden], .garam-guest-landing [hidden] { display:none !important; }
.garam-guest-landing { min-height:calc(100dvh - 100px); width:100%;
    display:flex; align-items:center; justify-content:center; padding:22px 12px; }
.garam-guest-card { width:min(100%,530px); background:#fff; border:1px solid var(--garam-c-b1d8f2, #b1d8f2);
    border-radius:24px; padding:clamp(20px,5vw,36px);
    box-shadow:0 20px 60px rgba(var(--garam-rgb-044b7a, 4,75,122),.18); }
.garam-guest-card .garam-owner-modal-header h2 { font-size:clamp(25px,5vw,35px); }
.garam-guest-actions { justify-content:flex-end; }
.garam-guest-actions .garam-owner-action-primary { min-width:115px; }
.garam-inventory-layout { width:100%; max-width:1240px; margin:0 auto; }
.garam-inventory-hero { position:relative; z-index:2; overflow:visible; isolation:isolate;
    text-align:center; padding:44px 12px 48px; }
.garam-inventory-hero::before { content:""; position:absolute; inset:0; z-index:-1;
    background-image:radial-gradient(var(--garam-c-86c7ed, #86c7ed) 1px,transparent 1px);
    background-size:22px 22px; opacity:.28;
    mask-image:linear-gradient(to bottom,black 20%,transparent 95%); pointer-events:none; }
.garam-hero-title { display:flex; align-items:center; justify-content:center;
    flex-wrap:wrap; column-gap:18px; row-gap:10px; margin:0;
    color:#ffff; font-size:clamp(32px,6vw,76px); font-weight:700;
    line-height:1.1; letter-spacing:-.045em; }
.garam-avatar-control { position:relative; display:inline-flex; align-items:center;
    justify-content:center; flex-shrink:0; z-index:3; }
.garam-avatar-button { position:relative; display:inline-flex; align-items:center;
    justify-content:center; border:0; border-radius:50%; padding:0;
    background:transparent; cursor:pointer; overflow:hidden;
    transition:transform .18s; }
.garam-avatar-button:hover { transform:translateY(-2px) scale(1.035); }
.garam-avatar-button:focus-visible { outline:3px solid var(--garam-c-178fda, #178fda); outline-offset:7px; }
.garam-inventory-avatar { display:block; width:clamp(68px,7vw,96px);
    height:clamp(68px,7vw,96px); border-radius:50%; object-fit:cover;
    border:5px solid #fff; background:var(--garam-c-caeaff, #caeaff);
    box-shadow:0 8px 30px rgba(var(--garam-rgb-166396, 22,99,150),.23),0 0 0 3px var(--garam-c-91d5fa, #91d5fa);
    transition:opacity .18s ease; }
.garam-inventory-avatar.is-loading { opacity:.55; }
.garam-avatar-overlay { position:absolute; inset:5px; display:flex;
    flex-direction:column; align-items:center; justify-content:center;
    border-radius:50%; background:rgba(0,0,0,.62); color:#fff;
    font:inherit; font-size:clamp(12px,1.2vw,14px); font-weight:600;
    line-height:1.15; letter-spacing:0; text-transform:lowercase;
    opacity:0; pointer-events:none; transition:opacity .18s ease; }
.garam-avatar-button:hover .garam-avatar-overlay,
.garam-avatar-button:focus-visible .garam-avatar-overlay { opacity:1; }
.garam-owner-instruction { margin:17px 0 0; color:#ffff; font-size:16px; }
.garam-filter-panel { padding:24px; background:#fff; border:1px solid var(--garam-c-bbdef5, #bbdef5);
    border-radius:24px; box-shadow:0 14px 30px rgba(var(--garam-rgb-156399, 21,99,153),.12); }
.garam-filters { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:14px; }
.garam-filter { display:flex; flex-direction:column; gap:7px; min-width:0; }
.garam-filter span { color:var(--garam-c-44718d, #44718d); font-size:13px; font-weight:600; }
.garam-page .garam-filter .inputStyle { margin:0; display:block; width:100%; min-width:0; max-width:100%;
    height:45px; padding:10px 12px; border:1px solid var(--garam-c-b7d8ed, #b7d8ed); border-radius:13px;
    background:var(--garam-c-f0f9ff, #f0f9ff); color:var(--garam-c-123c5c, #123c5c); font:inherit; font-weight:500; font-size:14px; box-shadow:none; transition:none; }
.garam-filter .inputStyle::placeholder { color:var(--garam-c-84a9be, #84a9be); }
.garam-page .garam-filter .inputStyle:focus { outline:2px solid var(--garam-c-51a8e8, #51a8e8); outline-offset:1px; }
.garam-toolbar { display:flex; justify-content:space-between; align-items:end;
    flex-wrap:wrap; gap:12px; margin-top:16px; }
.garam-filter-hint { color:var(--garam-c-527f99, #527f99); font-size:12px; flex:1; min-width:205px; }
/* .garam-filter sets display:flex, which would beat the hidden attribute. */
.garam-page [data-for][hidden] { display:none !important; }
.garam-actions { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:9px; }
.garam-page .garam-button { display:inline-flex; justify-content:center; align-items:center; gap:7px;
    min-height:42px; padding:9px 15px; border-radius:13px; font:inherit; font-size:13px;
    font-weight:600; cursor:pointer; transition:background .15s,transform .15s; }
.garam-page .garam-button:active { transform:translateY(1px); }
.garam-page .garam-button-outline { border:1px solid var(--garam-c-a9cfea, #a9cfea); background:white; color:var(--garam-c-155a8d, #155a8d); }
.garam-page .garam-button-outline:hover { background:var(--garam-c-e5f5ff, #e5f5ff); }
.garam-page .garam-button-primary { border:1px solid var(--garam-c-0764a6, #0764a6); background:var(--garam-c-087cce, #087cce); color:white;
    box-shadow:0 4px 0 var(--garam-c-075a91, #075a91); }
.garam-page .garam-button-primary:hover { background:var(--garam-c-056aae, #056aae); }
.garam-page .garam-button-icon { min-width:42px; border:1px solid var(--garam-c-a9cfea, #a9cfea); background:white; padding:8px; }
.garam-results-heading { display:flex; align-items:center; min-height:44px; margin-top:17px; }
#inventoryCount { margin:0; color:var(--garam-c-096dae, #096dae); font-size:14px; font-weight:600; }
.garam-card-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr));
    align-items:start; gap:14px; width:100%; margin:0 auto; opacity:1; transition:opacity .2s; }
.garam-pagination { display:flex; justify-content:center; align-items:center; gap:10px; margin-top:24px; }
#pageDisplay { min-width:110px; text-align:center; color:var(--garam-c-155a8d, #155a8d); font-weight:600; }

/* Server-rendered cards: only copy # badge, no rarity badge. */
.garam-card-tile { min-width:0; padding:6px; border-radius:17px;
    background:var(--garam-c-e9f7ff, #e9f7ff); border:1px solid var(--garam-c-b9def3, #b9def3); }
.garam-card-open { position:relative; display:block; width:100%; border:0; border-radius:13px;
    background:transparent; padding:0; overflow:hidden; cursor:pointer; color:inherit; }
.garam-card-open:focus-visible { outline:3px solid var(--garam-c-2396e2, #2396e2); outline-offset:2px; }
.garam-card-image { display:block; width:100%; aspect-ratio:188 / 279;
    height:auto; object-fit:cover; border-radius:25px; }
.garam-card-badge { position:absolute; top:3px; z-index:1; display:inline-flex; align-items:center;
    justify-content:center; min-height:24px; border-radius:9px; padding:2px 9px;
    font-weight:600; font-size:12px; line-height:1; pointer-events:none; }
/* The copy number: same look as the pickers' (.auction-pick-copy), in both themes. */
.garam-card-badge.garam-card-badge-copy { display:block; left:5px; top:5px; max-width:calc(100% - 10px); min-height:0;
    padding:2px 6px; border-radius:7px; background:rgba(20,36,56,.82); color:#fff;
    font-size:12px; line-height:1.3; font-variant-numeric:tabular-nums;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
html[data-garam-mode="dark"] body.garam-shell-body .garam-card-badge.garam-card-badge-copy { background:rgba(20,36,56,.82) !important; }
/* The cardholder is only displayed to the custom card's owner. */
.garam-card-badge-holder { right:3px; top:auto; bottom:3px; font-size:18px;
    background:rgba(4,37,67,.72); color:white; padding:5px; }
/* Card details: "Remove cardholder" / "Remove card" asks once more, in red. */
.garam-modal-action.garam-holder-remove.is-confirming,
.garam-modal-action.garam-holder-remove.is-confirming:is(:hover,:focus-visible):not(:disabled) {
    background:#d3203a; border-color:#d3203a; color:#fff; filter:none; }
/* "Add cardholder" / "Add to a card": the Marketplace "Sell cards" dialog, above the card details.
   Cardholder tiles show the holder picture like the Marketplace item listings. */
.inv-pick-modal .market-sell-tile .marketplace-item-photo { display:flex !important; align-items:center; justify-content:center;
    aspect-ratio:188/279; cursor:pointer;
    background:radial-gradient(circle at 50% 40%, #fff 0%, var(--garam-c-d6efff, #d6efff) 75%); }
.inv-pick-modal .marketplace-card-photo.marketplace-item-photo.is-cardholder img { position:absolute; inset:0;
    width:100%; height:100%; max-width:none; max-height:none; aspect-ratio:auto; object-fit:contain; border-radius:0; }
html[data-garam-mode="dark"] body.garam-shell-body .inv-pick-modal .marketplace-item-photo { background:var(--garam-dark-hover) !important; }
/* "Already in a cardholder": it moves to this one (the bot's /cardholder use). */
.inv-pick-modal .inv-pick-flag { display:block; margin-top:7px; font-size:12px; font-weight:600; color:#b86a0b; }
html[data-garam-mode="dark"] body .inv-pick-modal .inv-pick-flag { color:#f1b86a; }
/* The Marketplace stylesheet also styles #pageDisplay; keep the inventory's own size. */
#pageDisplay { font-size:inherit; }
.garam-card-missing { display:flex; align-items:center; justify-content:center; width:100%;
    aspect-ratio:188 / 279; border-radius:12px; background:var(--garam-c-cae9f9, #cae9f9); color:var(--garam-c-27658a, #27658a); font-size:13px; }
.garam-empty-inventory { grid-column:1 / -1; display:flex; justify-content:center;
    align-items:center; gap:16px; padding:50px 12px; color:var(--garam-c-27658a, #27658a); }

/* User-selection modal: separate from the card's 3D modal. */
.garam-owner-modal { position:fixed; inset:0; z-index:100001; display:flex;
    align-items:center; justify-content:center; padding:18px;
    background:rgba(var(--garam-rgb-062743, 6,39,67),.7); opacity:0; visibility:hidden;
    pointer-events:none; transition:opacity .2s; }
.garam-owner-modal.is-open { opacity:1; visibility:visible; pointer-events:auto; }
.garam-owner-modal-panel { width:min(100%,485px); max-height:calc(100dvh - 36px);
    overflow:auto; padding:23px; border:1px solid var(--garam-c-b1d8f2, #b1d8f2); border-radius:23px;
    background:#fff; box-shadow:0 24px 70px rgba(var(--garam-rgb-042543, 4,37,67),.35); }
.garam-owner-modal-header { display:flex; align-items:center; justify-content:space-between;
    gap:12px; }
.garam-owner-modal-header h2 { margin:0; color:var(--garam-c-123c5c, #123c5c); font-size:24px; font-weight:700; }
.garam-owner-modal-description { margin:13px 0 21px; color:var(--garam-c-537c97, #537c97); font-size:14px; }
.garam-owner-form { display:flex; flex-direction:column; gap:10px; }
.garam-owner-form label { color:var(--garam-c-356d91, #356d91); font-size:14px; font-weight:600; }
.garam-owner-id-input { min-height:48px; padding:11px 13px;
    border:1px solid var(--garam-c-a9cfea, #a9cfea); border-radius:13px; outline:0; background:var(--garam-c-f0f9ff, #f0f9ff);
    color:var(--garam-c-123c5c, #123c5c); font:inherit; font-size:15px; }
.garam-owner-id-input:focus { border-color:var(--garam-c-1687ce, #1687ce); box-shadow:0 0 0 3px var(--garam-c-d6efff, #d6efff); }
.garam-owner-id-input::placeholder { color:var(--garam-c-8caebe, #8caebe); }
.garam-owner-error { margin:0; font-size:13px; color:#b32b42; }
.garam-owner-modal-actions { display:flex; align-items:center; justify-content:space-between;
    flex-wrap:wrap; gap:10px; margin-top:14px; }
.garam-owner-action { display:inline-flex; align-items:center; justify-content:center;
    min-height:44px; padding:10px 19px; border-radius:12px;
    font:inherit; font-size:14px; font-weight:600; cursor:pointer; }
.garam-owner-action-outline { border:1px solid var(--garam-c-a9cfea, #a9cfea); background:#fff; color:var(--garam-c-155a8d, #155a8d); }
.garam-owner-action-outline:hover { background:var(--garam-c-e5f5ff, #e5f5ff); }
.garam-owner-action-primary { min-width:92px; border:1px solid var(--garam-c-0764a6, #0764a6);
    background:var(--garam-c-087cce, #087cce); color:white; box-shadow:0 4px 0 var(--garam-c-075a91, #075a91); }
.garam-owner-action-primary:hover { background:var(--garam-c-056aae, #056aae); }
.garam-owner-action:disabled { opacity:.55; cursor:wait; }
.garam-owner-action:focus-visible { outline:3px solid var(--garam-c-178fda, #178fda); outline-offset:2px; }
@media(max-width:1050px) {
    .garam-filters { grid-template-columns:repeat(3,minmax(0,1fr)); }
    .garam-card-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
}
@media(max-width:740px) {
    /* Keep the entire heading centered; the instruction is always below it. */
    .garam-inventory-hero {
        display:flex; flex-direction:column; align-items:center;
        justify-content:center; text-align:center;
        padding:28px 9px 34px;
    }
    #garamInventoryTitle {
        display:flex; width:100%; margin:0 auto;
        align-items:center; justify-content:center; flex-wrap:wrap;
        text-align:center; font-size:clamp(32px,7vw,50px); gap:12px;
    }
    #garamOwnerInstruction {
        display:block; width:100%; margin:16px auto 0;
        text-align:center; font-size:14px;
    }
    .garam-page { padding:12px 9px 32px; }
    .garam-filter-panel { padding:16px; border-radius:18px; }
    .garam-filters { grid-template-columns:repeat(2,minmax(0,1fr)); gap:11px; }
    .garam-card-grid { grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }
    .garam-actions { width:100%; justify-content:flex-end; }
    .garam-card-badge { padding:2px 6px; font-size:12px; min-height:21px; }
    .garam-card-badge.garam-card-badge-copy { font-size:12px; }
}
@media(max-width:460px) {
    .garam-filters { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .garam-card-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
    .garam-owner-modal-panel { padding:16px; }
    .garam-filter-hint { min-width:0; }
    .garam-page .garam-button { padding:9px 11px; }
}
@media(prefers-reduced-motion:reduce) {
    .garam-owner-modal,.garam-card-grid,.garam-page .garam-button,
    .garam-avatar-button,.garam-avatar-overlay { transition:none; }
}
