/* Pack Opener dashboard - layout ported from the Studio dashboard (studio/src/pages/StudioHome
   + ui/StudioSidebar): purple sidebar on the left, scrolling main column on the right. The pack
   opening animation itself lives in /pack-opener/pack.css */

html, body {
    height: 100%;
    overflow: hidden;
}

/* the page gradient on its own fixed layer instead of base.css's fixed body background - iOS
   Safari doesn't support background-attachment: fixed, and with <body> as the scroll container
   (phones, below) it drew no gradient at all, just white. sits under .bgBlooks (z-index -1) */
body {
    background: none;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background: var(--page-bg);
    pointer-events: none;
}

/* fixed rather than in-flow: the ad script appends its own footer after this, which makes the
   document taller than the viewport - pinned like this, nothing (scrollIntoView, focusing a
   card) can scroll the dashboard half out of view */
.po-layout {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: grid;
    grid-template-columns: clamp(13rem, 16vw, 18rem) 1fr;
    /* the site navbar on top of the main column (moved in by js/pack-opener.js), then the rest
       exactly the layout's height - an auto row would grow to fit a tall sidebar and push its
       bottom (the iBlooket.com link) off screen */
    grid-template-rows: auto minmax(0, 1fr);
}

/* the sidebar runs the full height, beside the navbar too */
.po-sidebar {
    grid-row: 1 / -1;
}

/* the site navbar (css/navbar.css), spanning just the main column - without its iBlooket logo,
   so its links sit on the right as usual */
.po-layout > nav {
    grid-column: 2;
    justify-content: flex-end;
}

/* ── sidebar ── */

.po-sidebar {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    /* the sidebar itself never scrolls - on short windows only the admin panel's options list
       (.po-admin-options) does, so the logo, "Admin Panel" title and footer stay put */
    overflow: hidden;
    /* like Studio's sidebar: the purple runs to the bottom of the window, behind the ad, while
       the bottom padding (the ad's measured height, --ad-space) keeps its contents above it */
    padding: 0.75rem 0 calc(1.5rem + var(--ad-space, 0px));
    background: var(--purple);
    box-shadow: inset -10px 0 #0003;
}

.po-logo {
    flex-shrink: 0;
    display: block;
    padding: 0.5rem 1rem;
    margin-bottom: 1.5rem;
    font-family: var(--font-heading);
    font-size: 2.25rem;
    line-height: 0.85;
    color: #fff;
    text-decoration: none;
    text-shadow: 3px 3px rgba(0, 0, 0, 0.2);
}

.po-logo-sub {
    display: block;
    margin-top: 0.5rem;
    font-family: var(--font-studio);
    font-size: 0.7em;
}

.po-sidebar-footer {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    margin-top: auto;
}

/* ── admin panel ── */

/* shrinks (down to nothing) when the window is too short for everything, so its options list
   gets the room that's left and scrolls. no right padding: the options list reaches the
   sidebar's right edge so its scrollbar can sit beside the darker strip - the title gets the
   1.6rem itself, and the list's reserved scrollbar gutter is that same 1.6rem */
.po-admin {
    display: flex;
    flex-direction: column;
    flex: 0 1 auto;
    min-height: 0;
    gap: 0.6rem;
    padding: 0 0 0 1rem;
    color: #fff;
}

.po-admin-options {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-height: 0;
    overflow-y: auto;
    /* always kept, scrolling or not, so the options are the same width either way (and the
       same width they had before this list scrolled on its own) - 25.6px = 1.6rem */
    scrollbar-gutter: stable;
    /* a small gap between the option cards and the scrollbar beside them - the same 6px the
       bar keeps from the sidebar's darker edge on its other side */
    padding-right: 6px;
}

/* the options list's scrollbar: the same thin translucent-white bar as Studio's sidebars
   (studio/src/pages/PackMaker.module.css's .sidebarScroll, blook-maker's RightSidebar.module.css).
   Chromium/WebKit only; other browsers keep their native scrollbar.
   a scrollbar always sits flush against its element's right edge, which here is the sidebar's
   darker 10px edge (its inset box-shadow). so the bar is drawn 9.6px wide (0.6rem) inside a
   wider scrollbar whose right 16px - that edge plus a 6px gap - is a transparent border the
   background is clipped off of. the radii are split so the visible bar still gets round ends:
   the right side's horizontal radius is 16px larger, which the border then eats back */
.po-admin-options::-webkit-scrollbar {
    width: 25.6px;
}

.po-admin-options::-webkit-scrollbar-track,
.po-admin-options::-webkit-scrollbar-thumb {
    border-right: 16px solid transparent;
    background-clip: padding-box;
    border-radius: 4.8px 20.8px 20.8px 4.8px / 4.8px;
}

.po-admin-options::-webkit-scrollbar-track {
    background-color: rgba(255, 255, 255, 0.1);
    margin: 0.2rem;
}

.po-admin-options::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.4);
}

.po-admin-options::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.6);
}

.po-admin-title {
    flex-shrink: 0;
    margin-right: 1.6rem;
    margin-bottom: 0.2rem;
    font-size: 1.5rem;
    text-align: left;
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
}

/* the option's name runs across the whole row; its description and switch sit side by side
   underneath it */
.po-toggle {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.15rem 0.75rem;
    padding: 0.7rem 0.8rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: background-color 0.15s;
}

.po-toggle:hover {
    background: rgba(255, 255, 255, 0.16);
}

/* the "(Beta)" after Community Packs - a little faded, same as Studio's Community tab
   (studio/src/ui/StudioSidebar's .betaTag) */
.po-beta {
    opacity: 0.7;
}

/* Custom Packs and Edit Mode while Community Packs is on: shown off, and can't be changed */
.po-toggle.locked {
    cursor: not-allowed;
    opacity: 0.5;
}

.po-toggle.locked:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* its name becomes the grid's first cell, beside the switch (each description is in the name's
   "i" tooltip, .po-info-tip) */
.po-toggle-text {
    display: contents;
}

.po-toggle-label {
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 1.15rem;
}

/* the Day of the Week dropdown, sitting where a toggle's switch would - the site's own
   .userInput look (base.css, e.g. the calculator's pack picker): solid --blue1 with a darker
   3D bottom edge and a brighter hover, sized down to suit the sidebar */
.po-select {
    grid-column: 2;
    margin-bottom: 4px; /* room for the bottom edge, so it doesn't crowd the card's padding */
    padding: 0.3rem 1.8rem 0.3rem 0.65rem;
    border: none;
    border-radius: 0.5rem;
    background: var(--blue1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.5rem center / 0.85rem;
    box-shadow:
        0 4px color-mix(in srgb, var(--blue1) 80%, black),
        0 6px rgba(0, 0, 0, 0.1);
    color: #fff;
    text-shadow: 1px 1px rgba(0, 0, 0, 0.2);
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 0.9rem;
    appearance: none;
    cursor: pointer;
    transition: filter 0.15s;
}

.po-select:hover {
    filter: brightness(110%);
}

.po-select:focus {
    outline: none;
}

.po-select:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* the open list, same as .userInput option */
.po-select option {
    background-color: var(--blue1);
    color: #fff;
}

/* the real checkbox stays in the DOM (keyboard + screen readers) but visually hidden;
   .po-switch right after it draws the pill */
.po-toggle input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.po-switch {
    /* the Blooket Calculator's toggle (css/calculator.css .switch / .slider), a little smaller
       to suit the sidebar */
    --button-width: 3rem;
    --button-height: 1.7rem;
    --toggle-diameter: 1.25rem;
    --button-toggle-offset: calc((var(--button-height) - var(--toggle-diameter)) / 2);
    --toggle-shadow-offset: 10px;
    position: relative;
    flex-shrink: 0;
    width: var(--button-width);
    height: var(--button-height);
    border-radius: calc(var(--button-height) / 2);
    /* transparent black when off, rather than the calculator's gray */
    background-color: rgba(0, 0, 0, 0.3);
    transition: 0.3s all ease-in-out;
}

.po-toggle:hover .po-switch {
    filter: brightness(1.05);
}

.po-switch::after {
    content: "";
    position: absolute;
    top: var(--button-toggle-offset);
    left: 0;
    width: var(--toggle-diameter);
    height: var(--toggle-diameter);
    border-radius: calc(var(--toggle-diameter) / 2);
    background-color: #fff;
    box-shadow: var(--toggle-shadow-offset) 0 calc(var(--toggle-shadow-offset) * 4) rgba(0, 0, 0, 0.1);
    transform: translateX(var(--button-toggle-offset));
    transition: 0.3s all ease-in-out;
}

.po-toggle input:checked + .po-switch {
    background-color: var(--blue1);
}

.po-toggle input:checked + .po-switch::after {
    transform: translateX(calc(var(--button-width) - var(--toggle-diameter) - var(--button-toggle-offset)));
    box-shadow: calc(var(--toggle-shadow-offset) * -1) 0 calc(var(--toggle-shadow-offset) * 4) rgba(0, 0, 0, 0.1);
}

.po-toggle input:focus-visible + .po-switch {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* the "i" after the Edit Mode name - hovering (or focusing/tapping) it shows the tip below
   the option, spanning the option's full width so the sidebar never clips it */
.po-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.05rem;
    height: 1.05rem;
    margin-left: 0.15rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: 0.75rem;
    line-height: 1;
    vertical-align: 0.15em;
    cursor: help;
    transition: background-color 0.15s;
}

.po-info:hover,
.po-info:focus-visible {
    background: rgba(255, 255, 255, 0.45);
    outline: none;
}

/* fixed, not absolute: the options list scrolls (.po-admin-options), and a tip inside it would
   be cut off at its edges - plus even hidden, the last option's tip would hang below the list and
   make it scrollable on any window. js/pack-opener.js (placeInfoTip) puts each tip just under its
   option card, the card's width, or above it when there's no room below */
.po-info-tip {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 5;
    padding: 0.55rem 0.7rem;
    border-radius: 0.6rem;
    background: rgba(0, 0, 0, 0.85);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    color: #fff;
    font-family: var(--font-main);
    font-style: normal;
    font-weight: 500;
    font-size: 0.85rem;
    line-height: 1.35;
    text-wrap: pretty;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s, visibility 0.15s;
}

.po-toggle:has(.po-info:hover) .po-info-tip,
.po-toggle:has(.po-info:focus) .po-info-tip {
    opacity: 1;
    visibility: visible;
}

.po-admin-btn {
    align-self: flex-start;
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 0.5rem;
    background: var(--red);
    box-shadow: inset 0 -3px rgba(0, 0, 0, 0.2);
    color: #fff;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
}

.po-admin-btn:hover {
    filter: brightness(110%);
}

/* pill bleeds flush to the sidebar's left edge, rounded only on the right */
.po-nav-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: calc(100% - 2.5rem);
    padding: 0.65rem 1rem 0.65rem 1.6rem;
    border-radius: 0 0.6rem 0.6rem 0;
    color: #fff;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.po-nav-item svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.po-nav-item:hover {
    background: #fff;
    color: var(--purple);
}

/* ── main column ── */

/* the packs grid's scrollbar: the locker's inset style (.po-locker below), in transparent
   white. no scrollbar-color here - Chrome ignores these ::-webkit-scrollbar parts once it's set */
.po-main::-webkit-scrollbar { width: 1.4rem; }
.po-main::-webkit-scrollbar-track,
.po-main::-webkit-scrollbar-thumb {
    border: 0.4rem solid transparent;
    border-radius: 1rem;
    background-clip: padding-box;
}
.po-main::-webkit-scrollbar-track { background-color: rgba(255, 255, 255, 0.18); }
.po-main::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, 0.55); }
.po-main::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, 0.7); }

.po-main {
    /* runs the full height, behind the bottom ad (packs/locker stay visible through a
       semi-transparent one), while the bottom padding grows by the ad's measured height so the
       end of the list can still be scrolled clear of it - same idea as the sidebar */
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    /* the scrollbar's space is always kept, scrolling or not - otherwise a short list (a couple of
       community packs) loses the scrollbar, the column gets wider, and every pack card (which
       stretches to fill its row) grows compared with the long official list */
    scrollbar-gutter: stable;
    padding: 2rem 2.5rem calc(8rem + var(--ad-space, 0px));
}

.po-header {
    margin-bottom: 1.75rem;
}

/* base.css centers every h1 and scales it on hover - neither fits a dashboard title */
.po-title {
    margin: 0;
    font-size: 2rem;
    text-align: left;
}

.po-title:hover {
    cursor: default;
    transform: none;
}

.po-subtitle {
    margin-top: 0.25rem;
    font-family: var(--font-main);
    color: #fff;
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
    opacity: 0.85;
}

/* pack sections sit straight on the page background - no panel around them */
.po-section {
    margin-bottom: 2rem;
    color: #fff;
}

/* the About + FAQ under the packs - a quiet translucent panel, smaller than the page's own
   headings, so it reads as a footnote to the tool rather than part of it */
.po-about {
    margin-top: 3rem;
    padding: 1.5rem 1.75rem;
    border-radius: 1rem;
    background: rgba(0, 0, 0, 0.07);
    color: #fff;
    font-family: var(--font-main);
}

.po-about-title {
    margin: 0 0 0.6rem;
    font-size: 1.6rem;
    text-align: left;
}

.po-about-subtitle {
    margin: 1.1rem 0 0.5rem;
    font-size: 1.2rem;
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
    text-align: left;
}

.po-about p {
    margin: 0 0 0.6rem;
    line-height: 1.5;
    opacity: 0.9;
}

.po-about a {
    color: #fff;
    text-decoration: underline;
}

.po-faqs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: 0.75rem 1.5rem;
    margin: 0;
}

.po-faqs dt {
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.po-faqs dd {
    margin: 0;
    line-height: 1.45;
    opacity: 0.85;
}

.po-about .po-about-disclaimer {
    margin: 1.25rem 0 0;
    font-size: 0.85rem;
    opacity: 0.6;
}

/* Packs / Locker switch - the Account Calculator's segmented toggle
   (advanced-calculator.css .acToggle + account-calculator.css .avViewToggle): a translucent
   pill with a white highlight that slides under the active option */
.po-view-toggle {
    position: relative;
    display: flex;
    min-width: 17rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.po-view-highlight {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    border-radius: 0.75rem;
    background: #fff;
    transition: left 0.25s ease;
}

.po-view-toggle.pos-2 .po-view-highlight {
    left: 50%;
}

.po-view-option {
    position: relative; /* above the highlight */
    flex: 1;
    padding: 0.6rem 1rem;
    border: none;
    background: none;
    color: #fff;
    font-family: var(--font-heading);
    font-size: calc(0.9rem + 0.4vw);
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: color 0.2s;
}

.po-view-option.active {
    color: var(--purple);
    text-shadow: none;
}

.po-view-option:focus-visible {
    outline: 3px solid #fff;
    outline-offset: -3px;
    border-radius: 0.75rem;
}

#packsView[hidden],
#lockerView[hidden],
.po-reset-btn[hidden] {
    display: none;
}

/* ── a ?community=<id> link's banner (js/pack-opener.js showCommunityBanner) - the locker's
   purple box (.po-locker) above the Packs / Locker switch ── */
.po-community {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--purple);
    border: 6px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    box-shadow: 4px 4px rgba(0, 0, 0, 0.2);
    color: #fff;
}

.po-community[hidden] {
    display: none;
}

.po-community.error {
    background: color-mix(in srgb, var(--red) 80%, black);
}

.po-community-label {
    padding: 0.1rem 0.55rem;
    border-radius: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 0.8rem;
}

.po-community-name {
    font-size: calc(1.1rem + 1vw);
    text-shadow: 3px 3px rgba(0, 0, 0, 0.2);
    overflow-wrap: anywhere;
}

.po-community-creator,
.po-community-status {
    font-family: var(--font-main);
    font-weight: 700;
}

/* the creator's own line breaks are kept - it's still plain text */
.po-community-description {
    font-family: var(--font-main);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-width: 60rem;
}

.po-community-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-top: 0.4rem;
}

/* the Reset Locker button's shape, in green */
.po-community-open {
    padding: 0.5rem 1.1rem;
    border: none;
    border-radius: 0.6rem;
    background: var(--green);
    box-shadow: inset 0 -3px rgba(0, 0, 0, 0.2);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1.05rem;
    text-shadow: 1px 1px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: filter 0.15s;
}

.po-community-open:hover {
    filter: brightness(110%);
}

.po-community-link {
    font-family: var(--font-main);
    font-weight: 700;
    color: #fff;
}

/* a section heading with a button beside it (Locker + Reset) */
.po-section-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.po-reset-btn {
    padding: 0.4rem 0.9rem;
    border: none;
    border-radius: 0.6rem;
    background: var(--red);
    box-shadow: inset 0 -3px rgba(0, 0, 0, 0.2);
    color: #fff;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 0.95rem;
    text-shadow: 1px 1px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: filter 0.15s, background-color 0.15s;
}

.po-reset-btn:hover:not(:disabled) {
    filter: brightness(110%);
}

/* first click: asks for a second one to confirm */
.po-reset-btn.armed {
    background: #b3200a;
}

.po-reset-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* ── locker - same layout as the Account Calculator's (css/account-calculator.css .avPacks):
   one purple box that scrolls on its own, a section per pack ── */

.po-locker {
    display: flex;
    flex-direction: column;
    gap: 2.25rem;
    max-height: 70vh;
    overflow-y: auto;
    padding: 1.25rem;
    background: var(--purple);
    border: 6px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    box-shadow: 4px 4px rgba(0, 0, 0, 0.2);
    color: #fff;
}

/* the scrollbar is inset from the box's edge: a transparent border around the track and
   thumb, with the fill clipped inside it. the edit-odds modal's blook list and the pack
   modal's drop rates use it too */
.po-locker::-webkit-scrollbar,
.po-edit-list::-webkit-scrollbar,
.po-buy-rates::-webkit-scrollbar { width: 1.4rem; }
.po-locker::-webkit-scrollbar-track,
.po-locker::-webkit-scrollbar-thumb,
.po-edit-list::-webkit-scrollbar-track,
.po-edit-list::-webkit-scrollbar-thumb,
.po-buy-rates::-webkit-scrollbar-track,
.po-buy-rates::-webkit-scrollbar-thumb {
    border: 0.4rem solid transparent;
    border-radius: 1rem;
    background-clip: padding-box;
}
.po-locker::-webkit-scrollbar-track,
.po-edit-list::-webkit-scrollbar-track,
.po-buy-rates::-webkit-scrollbar-track { background-color: rgba(255, 255, 255, 0.1); }
.po-locker::-webkit-scrollbar-thumb,
.po-edit-list::-webkit-scrollbar-thumb,
.po-buy-rates::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, 0.4); }

.po-locker-pack {
    display: flex;
    flex-shrink: 0;
    flex-direction: column;
    gap: 0.6rem;
}

/* the heading sits on a faint pattern of the pack's icon, with a solid white underline
   drawn as its own layer on top */
.po-locker-head {
    position: relative;
    display: flex;
    align-items: center;
    padding-bottom: calc(0.4rem + 4px);
}

.po-locker-head::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    border-radius: 2px;
    background: #fff;
}

.po-locker-pattern {
    position: absolute;
    top: -0.5rem;
    left: 0;
    width: 100%;
    /* from just above the heading down to the bottom of its white underline - the svg clips
       the tiled icons there instead of letting them run into the blooks below */
    height: calc(100% + 0.5rem);
    opacity: 0.15;
    /* the same white silhouette as the icon on the pack art (.po-pack-icon) */
    filter: brightness(0) invert(100%);
    pointer-events: none;
}

/* sized like base.css's h2, which the Account Calculator's pack names use */
.po-locker-name {
    position: relative;
    font-size: calc(0.5rem + 1.5vw);
    line-height: 1.15;
    text-align: left;
    text-shadow: 4px 4px rgba(0, 0, 0, 0.2);
}

/* tiles stretch so each row fills the section edge to edge */
.po-locker-blooks {
    --tile: 4.25rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--tile), 1fr));
    gap: 0.75rem;
}

.po-locker-blook {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
}

.po-locker-blook img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: grayscale(1) brightness(0.6);
    opacity: 0.45;
}

.po-locker-blook.owned img {
    filter: drop-shadow(4px 5px rgba(0, 0, 0, 0.25));
    opacity: 1;
}

.po-locker-count {
    position: absolute;
    left: 0.1rem;
    bottom: -0.2rem;
    min-width: 1.35rem;
    padding: 0 0.25rem;
    border-radius: 999px;
    color: #fff;
    font-family: var(--font-heading);
    font-size: 0.78rem;
    line-height: 1.35rem;
    text-align: center;
    /* thin black outline on the digits, drawn behind the white fill */
    -webkit-text-stroke: 2px #000;
    paint-order: stroke fill;
}

/* ── locker stats - same panel + tiles as the Account Calculator's "Account Stats"
   (account-calculator.css .avPanel / .avTiles) ── */

.po-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: var(--purple);
    border: 6px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    box-shadow: 4px 4px rgba(0, 0, 0, 0.2);
    color: #fff;
    font-family: var(--font-heading);
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
}

/* underline as a pseudo-element so its ends can be rounded, like the locker's pack headings */
.po-stats-title {
    position: relative;
    padding-bottom: calc(0.4rem + 4px);
    font-size: calc(0.5rem + 1.5vw);
    line-height: 1.15;
    text-align: left;
}

.po-stats-title::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    border-radius: 2px;
    background: #fff;
}

.po-stat-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 0.6rem;
}

.po-stat-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.75rem 0.6rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    text-align: center;
}

.po-stat-val {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: calc(1rem + 0.6vw);
}

.po-stat-val img {
    width: 1em;
    height: 1em;
}

.po-stat-val small {
    font-family: var(--font-main);
    font-size: 0.6em;
    opacity: 0.8;
}

.po-stat-label {
    font-family: var(--font-main);
    font-size: 0.9rem;
    opacity: 0.9;
}

/* ── pack cards - same look as Studio's Pack Creator preview
   (studio/src/pages/PackMaker.module.css: .previewCombined and friends). every size is a
   proportion of the card's own width (cqw), so it scales with the grid column ── */

.po-pack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 1.25rem;
}

/* Community Packs on: page selector - the filter row's last item, pushed to its right end
   (margin-left: auto). the same as Studio's Community page */
.po-pager {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.po-pager[hidden] {
    display: none;
}

.po-pager-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    align-self: stretch;
    border: none;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.po-pager-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.28);
}

.po-pager-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.po-pager-label {
    color: #fff;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
}

/* Community Packs on: search, sort and Featured / Epic filters above the grid - the same
   controls (and colors) as Studio's Community page */
.po-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.po-filters[hidden] {
    display: none;
}

.po-search {
    flex: 1;
    min-width: 12rem;
    max-width: 28rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.75rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.po-search input {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0;
    border: none;
    background: none;
    color: #fff;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 1rem;
}

.po-search input::placeholder {
    color: rgba(255, 255, 255, 0.75);
}

.po-search input:focus {
    outline: none;
}

.po-search:focus-within {
    outline: 3px solid #fff;
}

.po-sort {
    padding: 0.6rem 0.75rem;
    border: none;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
}

.po-sort option {
    background: var(--purple);
}

.po-rating-filters {
    display: flex;
    gap: 0.5rem;
}

.po-rating-filter {
    padding: 0.6rem 0.9rem;
    border: 2px solid transparent;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.po-rating-filter:hover {
    background: rgba(255, 255, 255, 0.28);
}

.po-rating-filter.rating-featured {
    border-color: #ffcc00;
}

.po-rating-filter.rating-epic {
    border-color: #ff6a00;
}

.po-rating-filter.on.rating-featured {
    background: #ffcc00;
    color: #5a3d00;
}

.po-rating-filter.on.rating-epic {
    background: linear-gradient(135deg, #ffa21a, #ff4a1c);
    color: #3d1000;
}

.po-rating-filter.rating-favorites {
    border-color: #ff3b6b;
}

.po-rating-filter.on.rating-favorites {
    background: #ff3b6b;
    color: #fff;
}

.po-rating-filter.on.rating-favorites svg {
    fill: currentColor;
}

/* Community Packs on, with nothing to show yet ("Loading…", "No community packs yet", an error) */
.po-grid-note {
    grid-column: 1 / -1;
    font-family: var(--font-main);
    font-weight: 700;
    color: #fff;
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
}

/* a community pack fetching its blooks after being clicked */
.po-pack-card.loading {
    cursor: progress;
    opacity: 0.7;
}

.po-pack-card {
    container-type: inline-size;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

/* 21:26 portrait card, rounded corners on this wrapper alone */
.po-pack-face {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    aspect-ratio: 21 / 26;
    border-radius: 9.5238% / 7.6923%;
    overflow: hidden;
    box-shadow: 4px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

/* translucent white inner border, painted over the gradient + cost strip */
.po-pack-face::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 2.28571cqw rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

.po-pack-card:hover .po-pack-face {
    transform: scale(0.95);
}

/* rated community packs (Studio's Community page, PackCard.module.css): Featured a yellow ring
   hugging the card's rounded shape, Epic a single orange one - each with a soft glow */
.po-pack-card.rated-featured .po-pack-face {
    box-shadow:
        0 0 0 0.3rem #ffcc00,
        0 0 1.1rem 0.25rem rgba(255, 204, 0, 0.55),
        4px 4px rgba(0, 0, 0, 0.2);
}

.po-pack-card.rated-epic .po-pack-face {
    box-shadow:
        0 0 0 0.3rem #ff6a00,
        0 0 1.1rem 0.25rem rgba(255, 106, 0, 0.55),
        4px 4px rgba(0, 0, 0, 0.2);
}

/* the pack's radial gradient - always a perfect square (21/26 of a 21:26 box) */
.po-pack-gradient {
    position: relative;
    overflow: hidden; /* the corner icon runs off the edge - keep it off the cost strip */
    display: flex;
    flex: 0 0 80.76923%;
    align-items: center;
    justify-content: center;
}

/* the pack's icon, centered on the gradient's bottom-right (90%, 90%) behind the pack art -
   like Blooket's shop cards. the filter turns any icon into a white silhouette */
.po-pack-icon,
.po-buy-icon {
    position: absolute;
    top: 90%;
    left: 90%;
    width: 38%;
    transform: translate(-50%, -50%) rotate(10deg);
    opacity: 0.5;
    filter: brightness(0) invert(100%);
    pointer-events: none;
}

.po-buy-icon[hidden] {
    display: none;
}

.po-pack-art {
    position: relative; /* above the corner icon */
    width: 71.42857%;
    transform: rotate(10deg);
    filter: drop-shadow(0.95238cqw 0.95238cqw rgba(0, 0, 0, 0.2));
}

/* the cost strip - always this blue, whatever the pack's own colors */
.po-pack-cost {
    display: flex;
    flex: 0 0 19.23077%;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    box-sizing: border-box;
    padding: 0.4rem 0.4rem calc(0.4rem + 2.28571cqw);
    border-top: 1.90476cqw solid #fff;
    background: var(--blue2);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 12.38095cqw;
    text-shadow: 0.95238cqw 0.95238cqw rgba(0, 0, 0, 0.2);
}

.po-pack-cost img {
    width: 10.95238cqw;
    height: 10.95238cqw;
}

/* "No blooks yet" / "No odds set" in place of a price */
.po-pack-cost.note {
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 7cqw;
}

.po-pack-card.disabled {
    cursor: default;
}

.po-pack-card.disabled .po-pack-face {
    filter: grayscale(0.6) brightness(0.8);
}

.po-pack-card.disabled:hover .po-pack-face {
    transform: none;
}

.po-pack-badge {
    position: absolute;
    top: 4cqw;
    left: 4cqw;
    z-index: 2;
    padding: 0.15rem 0.55rem;
    border-radius: 0.5rem;
    background: var(--orange);
    color: #fff;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 0.85rem;
    text-shadow: 1px 1px rgba(0, 0, 0, 0.2);
}

/* a legacy seasonal pack's year, in the gradient's bottom-left corner */
.po-pack-year {
    position: absolute;
    bottom: 4cqw;
    left: 4cqw;
    z-index: 2;
    padding: 0.1rem 0.5rem;
    border-radius: 0.5rem;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    text-shadow: 1px 1px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

/* edit mode: a dashed outline on every pack so it reads as "click to edit" */
.editing .po-pack-face {
    outline: 3px dashed rgba(255, 255, 255, 0.85);
    outline-offset: 3px;
}

/* ...except community packs, which can't be edited (a keyboard focus ring still shows) */
.editing .po-pack-card.not-editable:not(:focus-visible) .po-pack-face {
    outline: none;
}

.po-pack-card:focus-visible {
    outline: none;
}

.po-pack-card:focus-visible .po-pack-face {
    outline: 3px solid #fff;
    outline-offset: 3px;
}


.po-rarity {
    padding: 0.05rem 0.5rem;
    border-radius: 0.5rem;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 0.7rem;
    color: #fff;
    text-shadow: 1px 1px rgba(0, 0, 0, 0.25);
}

/* ── buy modal - same layout as Blooket's market pack popup ── */

.po-buy {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
    gap: 1.6rem;
    align-items: center;
    width: min(47rem, 100%);
    max-height: 100%;
    overflow-y: auto;
    padding: 1.6rem 1.9rem 1.6rem 1.6rem;
    background: #9a49aa;
    border: 6px solid rgba(255, 255, 255, 0.2);
    border-radius: 1.25rem;
    box-shadow: 4px 4px rgba(0, 0, 0, 0.2);
    color: #fff;
    font-family: var(--font-main);
}

.po-buy-close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    width: 2.1rem;
    height: 2.1rem;
    padding: 0.35rem;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: color 0.15s;
}

.po-buy-close:hover {
    color: #fff;
}

.po-buy-close svg,
.po-chip-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* the pack on its own gradient, framed like the grid cards (translucent white inner border) */
.po-buy-showcase {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: 1.35rem;
    box-shadow: 4px 4px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.po-buy-showcase::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 0.5rem rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

.po-buy-art {
    position: relative; /* above the corner icon */
    width: 71.4%;
    transform: rotate(10deg);
    filter: drop-shadow(0.25rem 0.25rem rgba(0, 0, 0, 0.2));
}

.po-buy-art[hidden],
.po-buy-rates[hidden] {
    display: none;
}

/* drop rates take the pack art's place inside the same frame. the transparent border is the
   frame's 0.5rem white inner border (.po-buy-showcase::after) - the scrollbar sits inside it
   instead of under it, with its own inset as the gap. the dark fill still reaches the edge
   (backgrounds paint under the border) */
.po-buy-rates {
    align-self: stretch;
    width: 100%;
    overflow-y: auto;
    border: 0.5rem solid transparent;
    padding: 0.5rem 0.6rem;
    background: rgba(0, 0, 0, 0.45);
}

.po-rate-row {
    display: grid;
    grid-template-columns: 2.25rem minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.6rem;
    padding: 0.3rem 0;
}

.po-rate-blook {
    width: 2.25rem;
    height: 2.25rem;
    object-fit: contain;
}

.po-rate-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    font-size: 0.95rem;
}

.po-rate-pct {
    min-width: 3.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    text-align: right;
}

.po-buy-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    min-width: 0;
}

.po-buy-title {
    padding-right: 2rem;
    font-size: clamp(1.6rem, 2.6vw, 2.2rem);
    line-height: 1.1;
    text-align: left;
    text-shadow: none;
}

/* the name and its favorite heart, side by side - the row (not the name) keeps clear of the
   close button */
.po-buy-titlerow {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 100%;
    padding-right: 2rem;
}

.po-buy-titlerow .po-buy-title {
    padding-right: 0;
    min-width: 0;
}

/* just a heart - an outline, filled pink once favorited */
.po-buy-fav {
    flex-shrink: 0;
    display: flex;
    padding: 0.2rem;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: transform 0.15s, color 0.15s;
}

.po-buy-fav:hover {
    color: #fff;
    transform: scale(1.12);
}

.po-buy-fav.on {
    color: #ff3b6b;
}

.po-buy-fav.on svg {
    fill: currentColor;
}

/* "Designed by ..." under a community pack's name - sits close to the title */
.po-buy-creator {
    margin: -0.35rem 0 0;
    font-size: 1rem;
    font-weight: 700;
    opacity: 0.85;
    overflow-wrap: anywhere;
}

/* the small pale pill buttons (Show Drop Rates, quantity steps) */
.po-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.2rem;
    height: 2.05rem;
    padding: 0 0.6rem;
    border: none;
    border-radius: 0.55rem;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.15s;
}

.po-chip:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
}

.po-chip:disabled {
    background: rgba(0, 0, 0, 0.1);
    color: rgba(255, 255, 255, 0.3);
    cursor: default;
}

.po-chip-icon {
    padding: 0.45rem;
}

.po-buy-price {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 2.05rem;
    padding: 0 0.65rem;
    border-radius: 0.55rem;
    background: rgba(0, 0, 0, 0.15);
    font-weight: 700;
    font-size: 0.95rem;
}

.po-buy-price img {
    width: 1.3rem;
    height: 1.3rem;
}

.po-buy-qty {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-top: 1rem;
    font-weight: 700;
    font-size: clamp(1.1rem, 1.7vw, 1.35rem);
}

.po-buy-qty input {
    width: 4.3rem;
    height: 3.05rem;
    padding: 0 0.65rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.7rem;
    background: transparent;
    color: #fff;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 1.35rem;
    text-align: left;
    box-shadow: none;
    -moz-appearance: textfield;
}

.po-buy-qty input::-webkit-outer-spin-button,
.po-buy-qty input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.po-buy-qty input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
}

.po-buy-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.po-buy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 0.4rem;
    padding: 0.6rem 0.9rem;
    border: none;
    border-radius: 0.8rem;
    background: var(--blue3);
    box-shadow: inset 0 -0.35rem rgba(0, 0, 0, 0.25);
    color: #fff;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: clamp(1.15rem, 2vw, 1.6rem);
    cursor: pointer;
    transition: filter 0.15s;
}

.po-buy-btn:hover {
    filter: brightness(110%);
}

.po-buy-btn img {
    width: 1.1em;
    height: 1.1em;
}

/* ── Pack Results - Blooket's post-purchase summary ── */

.po-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    width: min(36rem, 100%);
    max-height: 100%;
    padding: 1.5rem 2rem 1.75rem;
    background: #9a49aa;
    border: 6px solid rgba(255, 255, 255, 0.2);
    border-radius: 1.25rem;
    box-shadow: 4px 4px rgba(0, 0, 0, 0.2);
    color: #fff;
}

.po-results-title {
    font-size: clamp(2rem, 4vw, 2.6rem);
    text-shadow: none;
}

.po-results-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.9rem;
    width: 100%;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.08);
}

.po-result {
    position: relative;
    flex-shrink: 0;
    width: 4.5rem;
    height: 4.5rem;
}

.po-result-blook {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* how many were pulled, in a little rarity-colored bubble on the bottom-left corner */
.po-result-count {
    position: absolute;
    left: -0.15rem;
    bottom: -0.15rem;
    min-width: 1.3rem;
    height: 1.3rem;
    padding: 0 0.3rem;
    border-radius: 0.65rem;
    color: #fff;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    line-height: 1.3rem;
    text-align: center;
    text-shadow: -1px -1px 0 #3a3a3a, 1px -1px 0 #3a3a3a, -1px 1px 0 #3a3a3a, 1px 1px 0 #3a3a3a;
}

/* tokens spent / earned / net profit, under the blooks */
.po-results-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
    width: 100%;
}

.po-results-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.6rem 0.4rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    text-align: center;
}

.po-results-stat-val {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font-heading);
    font-size: clamp(1rem, 2.4vw, 1.35rem);
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
}

.po-results-stat-val img {
    width: 1em;
    height: 1em;
}

.po-results-stat-val.profit {
    color: var(--green);
}

.po-results-stat-val.loss {
    color: var(--red);
}

.po-results-stat-label {
    font-family: var(--font-main);
    font-size: 0.85rem;
    opacity: 0.85;
}

.po-results-collect {
    padding: 0.55rem 1.9rem;
    border: none;
    border-radius: 0.8rem;
    background: var(--blue3);
    box-shadow: inset 0 -0.35rem rgba(0, 0, 0, 0.25);
    color: #fff;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 1.6rem;
    cursor: pointer;
    transition: filter 0.15s;
}

.po-results-collect:hover {
    filter: brightness(110%);
}

/* "help support iBlooket: subscribe" - stacked under the results card on its backdrop */
#resultsModal {
    flex-direction: column;
    gap: 0.9rem;
}

/* let the card shrink to make room for the support bar (its blook grid scrolls) */
#resultsModal .po-results {
    min-height: 0;
}

.po-support {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    flex-shrink: 0;
    color: #fff;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 1.75rem;
    text-align: center;
    text-shadow: 2px 2px rgba(0, 0, 0, 0.3);
}

.po-support-btn {
    padding: 0.45rem 1.4rem;
    border-radius: 0.7rem;
    background: #e62117;
    box-shadow: inset 0 -0.25rem rgba(0, 0, 0, 0.25);
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: 1.65rem;
    text-decoration: none;
    text-shadow: none;
    transition: filter 0.15s;
}

.po-support-btn:hover {
    filter: brightness(110%);
}

/* ── edit-odds modal ── */

.po-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    /* the bottom stays clear of the "do not sell" link (pinned above these popups) and, when
       there is one, the bottom ad - so no popup's buttons can end up underneath them */
    padding: 1rem 1rem calc(2.75rem + var(--ad-space, 0px));
    background: rgba(0, 0, 0, 0.55);
}

/* the link itself lifts a fixed 90px whenever the ad is present (see .consumer-privacy-footer-btn
   below), even before the ad has filled its slot - clear at least that much */
body.ad-present .po-modal-backdrop {
    padding-bottom: calc(2.75rem + max(90px, var(--ad-space, 0px)));
}

.po-modal-backdrop[hidden] {
    display: none;
}

.po-modal {
    display: flex;
    flex-direction: column;
    width: min(36rem, 100%);
    max-height: min(36rem, 100%); /* the blook list scrolls inside it */
    background: var(--purple);
    border: 6px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    box-shadow: 4px 4px rgba(0, 0, 0, 0.2);
    color: #fff;
    overflow: hidden;
}

.po-modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1rem 0.75rem;
}

.po-modal-pack {
    width: 3.5rem;
    transform: rotate(10deg);
    filter: drop-shadow(0.2rem 0.2rem rgba(0, 0, 0, 0.25));
}

.po-modal-title {
    font-size: 1.4rem;
    text-align: left;
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
}

.po-modal-sub {
    font-size: 0.85rem;
    opacity: 0.8;
}

.po-modal-close {
    align-self: flex-start;
    flex-shrink: 0;
    width: 2.2rem;
    height: 2.2rem;
    margin-left: auto;
    padding: 0.45rem;
    border: none;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
}

.po-modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.po-modal-close svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    stroke-linecap: round;
}

.po-edit-head,
.po-edit-row {
    display: grid;
    grid-template-columns: 1fr 4.5rem 6.5rem;
    align-items: center;
    gap: 0.75rem;
}

.po-edit-head {
    padding: 0 1.75rem 0.4rem 1rem;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.65;
}

.po-edit-head span:not(:first-child) {
    text-align: right;
}

.po-edit-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin: 0 1rem;
    padding: 0.5rem;
    border: 0.2rem solid #ae6dbb;
    border-radius: 0.5rem;
    background-color: color-mix(in srgb, var(--purple) 85%, black);
}

.po-edit-row {
    grid-template-columns: 2.75rem 1fr 4.5rem 6.5rem;
    padding: 0.4rem;
    border-radius: 0.5rem;
}

.po-edit-row.changed {
    background: rgba(255, 163, 30, 0.18);
}

.po-edit-blook {
    width: 2.75rem;
    height: 2.75rem;
    object-fit: contain;
    filter: drop-shadow(0.15rem 0.15rem rgba(0, 0, 0, 0.2));
}

.po-edit-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    min-width: 0;
}

.po-edit-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 0.95rem;
}

.po-edit-default {
    font-family: var(--font-main);
    font-size: 0.85rem;
    text-align: right;
    opacity: 0.7;
}

.po-edit-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font-main);
    font-weight: 700;
}

.po-edit-input {
    width: 100%;
    min-width: 0;
    padding: 0.35rem 0.5rem;
    border: none;
    border-radius: 0.5rem;
    background: #fff;
    color: var(--gray);
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 0.95rem;
    text-align: right;
}

.po-edit-input:focus {
    outline: 3px solid var(--orange);
}

.po-edit-empty {
    padding: 0.75rem;
    font-size: 0.9rem;
    opacity: 0.85;
}

.po-modal-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem 1rem;
}

.po-edit-total {
    font-family: var(--font-main);
    font-size: 0.9rem;
}

.po-edit-note {
    opacity: 0.75;
}

.po-modal-actions {
    display: flex;
    gap: 0.6rem;
    margin-left: auto;
}

.po-btn {
    --bg: var(--green);
    padding: 0.5rem 1.1rem;
    border: none;
    border-radius: 0.6rem;
    background: var(--bg);
    box-shadow: inset 0 -4px rgba(0, 0, 0, 0.2);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1rem;
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.po-btn:hover {
    filter: brightness(110%);
}

.po-btn-ghost {
    --bg: rgba(255, 255, 255, 0.15);
}

/* ── locker blook modal - the Account Calculator's single-blook modal (.modal + .avBlookModal
   in css/calculator.css / account-calculator.css), with Blooket's sell row ── */

.po-locker-blook {
    cursor: pointer;
    border-radius: 0.5rem;
    transition: transform 0.15s;
}

.po-locker-blook:hover {
    transform: scale(1.08);
}

.po-locker-blook:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.po-blook {
    position: relative;
    width: min(26rem, 100%);
    max-height: 100%;
    overflow-y: auto;
    padding: 1.5rem;
    background: radial-gradient(circle, var(--blue1) 0%, var(--blue2) 100%);
    border: 8px solid rgba(255, 255, 255, 0.2);
    border-radius: 1.25rem;
    box-shadow: 10px 10px rgba(0, 0, 0, 0.3);
    color: #fff;
}

.po-blook-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    font-family: var(--font-main);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.po-blook-close:hover {
    background: rgba(255, 255, 255, 0.4);
}

.po-detail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.po-detail h2 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: calc(1rem + 1.5vw);
    text-align: center;
    text-shadow: 4px 4px rgba(0, 0, 0, 0.2);
}

.po-detail-img {
    width: 7rem;
    height: 7rem;
    object-fit: contain;
    filter: drop-shadow(5px 6px rgba(0, 0, 0, 0.25));
}

.po-detail-rarity {
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-family: var(--font-heading);
    font-size: 1rem;
    white-space: nowrap;
}

.po-detail-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    width: 100%;
    margin: 0.4rem 0;
}

/* the Pack stat spans the top row, like the Account Calculator's */
.po-detail-stat:first-child:nth-last-child(odd) {
    grid-column: span 2;
}

.po-detail-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    padding: 0.5rem 0.6rem;
    border-radius: 0.75rem;
    background: rgba(0, 0, 0, 0.1);
    text-align: center;
}

.po-detail-label {
    font-family: var(--font-main);
    font-size: 0.9rem;
    opacity: 0.85;
}

.po-detail-val {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font-heading);
    font-size: 1.15rem;
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
}

.po-detail-val img {
    width: 1em;
    height: 1em;
}

.po-detail-note {
    margin: 0;
    font-family: var(--font-main);
    opacity: 0.85;
    text-align: center;
}

/* Blooket's sell row: "[ n ] / N total" over a "Sell n for (token) x" button */
.po-sell {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.po-sell-qty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 1.35rem;
}

.po-sell-qty input {
    width: 4.3rem;
    height: 3.05rem;
    padding: 0 0.65rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.7rem;
    background: transparent;
    color: #fff;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 1.35rem;
    text-align: right;
    -moz-appearance: textfield;
    appearance: textfield;
}

.po-sell-qty input::-webkit-outer-spin-button,
.po-sell-qty input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.po-sell-qty input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
}

.po-sell .po-buy-btn {
    margin-top: 0;
}

/* ── phones: sidebar collapses into a header bar above the main column ── */

@media only screen and (max-width: 768px) {
    .po-locker-blooks {
        --tile: 3.5rem;
    }

    /* smaller cards so phones fit (at least) two packs per row */
    .po-pack-grid {
        grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
        gap: 0.75rem;
    }

    .po-buy {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        padding: 1.25rem;
    }

    .po-buy-showcase {
        width: min(16rem, 100%);
        margin: 0 auto;
    }

    html, body {
        overflow: auto;
    }

    .po-layout {
        position: relative;
        display: flex;
        flex-direction: column;
    }

    /* the navbar goes above the sidebar's header bar here, stuck to the top while scrolling */
    .po-layout > nav {
        order: -1;
    }

    .po-sidebar {
        height: auto;
        overflow: visible;
        padding: 0.75rem 0;
        box-shadow: inset 0 -6px #0003;
    }

    .po-logo {
        margin-bottom: 0.75rem;
        font-size: 1.8rem;
    }

    .po-admin {
        padding: 0 1rem;
    }

    /* the whole page scrolls here, so the options list doesn't need to */
    .po-admin-options {
        overflow: visible;
        padding-right: 0;
    }

    .po-sidebar-footer {
        margin-top: 0.75rem;
    }

    .po-edit-head,
    .po-edit-row {
        grid-template-columns: 1fr 5.5rem;
    }

    .po-edit-row {
        grid-template-columns: 2.5rem 1fr 5.5rem;
    }

    .po-edit-head span:nth-child(2),
    .po-edit-default {
        display: none;
    }

    .po-main {
        height: auto;
        overflow: visible;
        padding: 1.5rem 1rem calc(8rem + var(--ad-space, 0px));
    }
}

/* ── Mediavine's "do not sell or share" link - placed exactly like Studio's
   (studio/src/index.css): pinned to the bottom center of the screen, shrunk and faded,
   lifted above the bottom ad once js/pack-opener.js marks <body> with .ad-present. this file
   loads after base.css, so these win over base.css's own .consumer-privacy-btn offset ── */
.consumer-privacy-footer-btn {
    height: 0 !important;
    overflow: visible !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    transform: translateX(-50%) !important;
    font-size: 0.65rem !important;
    opacity: 0.5 !important;
    z-index: 9999 !important;
}

body.ad-present .consumer-privacy-footer-btn {
    bottom: 90px !important;
}

/* the pack opening animation (#packOpener, z-index 10000 in pack.css) covers the ad and the
   privacy link: Mediavine's fixed bottom bar (#fixed_container_bottom, which holds the
   adhesion ad) and the link both sit at near-max z-index by default, so pin them just under
   it - still above the page and the buy/edit modals (9000). a plain stacking order rather
   than hiding them on open, so they're covered the instant the animation appears */
#fixed_container_bottom {
    z-index: 9998 !important;
}

/* ── Edit Mode: hacker theme ──
   body.hacker (set by js/pack-opener.js) turns the page background and sidebar into a
   black-and-neon-green terminal look, with #hackerBg's flickering 1s and 0s behind the page */

#hackerBg {
    position: fixed;
    inset: 0;
    z-index: 0; /* above the page background / .bgBlooks, below the layout */
    display: none;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* the page background is drawn on body::before (see the top of this file), so recolor that -
   a plain body background would sit underneath the gradient layer */
body.hacker::before {
    background: #010a04;
}

body.hacker #hackerBg {
    display: block;
}

body.hacker .bgBlooks {
    display: none;
}

body.hacker .po-sidebar {
    background: #03150a;
    box-shadow: inset -10px 0 rgba(0, 255, 102, 0.12);
}

body.hacker .po-logo,
body.hacker .po-admin-title {
    color: #39ff88;
    text-shadow: 0 0 10px rgba(57, 255, 136, 0.6);
}

body.hacker .po-toggle {
    background: rgba(0, 255, 102, 0.07);
    box-shadow: inset 0 0 0 1px rgba(0, 255, 102, 0.25);
}

body.hacker .po-toggle:hover {
    background: rgba(0, 255, 102, 0.13);
}

body.hacker .po-toggle-label {
    color: #b9ffd2;
}

body.hacker .po-select {
    background-color: #0b3d1e;
    box-shadow:
        0 4px #04160b,
        0 6px rgba(0, 0, 0, 0.1),
        inset 0 0 0 1px rgba(0, 255, 102, 0.35);
    color: #b9ffd2;
    text-shadow: none;
}

body.hacker .po-select option {
    background-color: #010a04;
    color: #b9ffd2;
}

body.hacker .po-nav-item {
    color: #b9ffd2;
}

body.hacker .po-nav-item:hover {
    background: #39ff88;
    color: #03150a;
}

body.hacker .po-info {
    background: rgba(0, 255, 102, 0.2);
    color: #b9ffd2;
}

body.hacker .po-info:hover,
body.hacker .po-info:focus-visible {
    background: rgba(0, 255, 102, 0.4);
}

body.hacker .po-info-tip {
    background: #010a04;
    box-shadow: inset 0 0 0 1px rgba(0, 255, 102, 0.35), 0 0 12px rgba(0, 255, 102, 0.15);
    color: #b9ffd2;
}

body.hacker .po-switch {
    background: rgba(0, 255, 102, 0.15);
}

body.hacker .po-toggle input:checked + .po-switch {
    background: #00d455;
    box-shadow: 0 0 10px rgba(0, 255, 102, 0.6);
}

body.hacker .po-title {
    color: #39ff88;
    text-shadow: 0 0 12px rgba(57, 255, 136, 0.55);
}

body.hacker .po-subtitle {
    color: #b9ffd2;
}

body.hacker .editing .po-pack-face {
    outline-color: #39ff88;
}

/* locker + stats panels: same terminal greens as the sidebar */
body.hacker .po-locker,
body.hacker .po-stats {
    background: #03150a;
    border-color: rgba(0, 255, 102, 0.35);
    box-shadow: 4px 4px rgba(0, 0, 0, 0.35), 0 0 18px rgba(0, 255, 102, 0.12);
}

body.hacker .po-locker-name,
body.hacker .po-stats-title {
    color: #39ff88;
    text-shadow: 0 0 10px rgba(57, 255, 136, 0.55);
}

body.hacker .po-locker-head::after,
body.hacker .po-stats-title::after {
    background: #39ff88;
    box-shadow: 0 0 8px rgba(57, 255, 136, 0.6);
}

body.hacker .po-locker-pattern {
    opacity: 0.1;
}

body.hacker .po-admin-options::-webkit-scrollbar-track,
body.hacker .po-locker::-webkit-scrollbar-track,
body.hacker .po-edit-list::-webkit-scrollbar-track,
body.hacker .po-buy-rates::-webkit-scrollbar-track {
    background-color: rgba(0, 255, 102, 0.08);
}

body.hacker .po-admin-options::-webkit-scrollbar-thumb,
body.hacker .po-locker::-webkit-scrollbar-thumb,
body.hacker .po-edit-list::-webkit-scrollbar-thumb,
body.hacker .po-buy-rates::-webkit-scrollbar-thumb {
    background-color: rgba(0, 255, 102, 0.4);
}

body.hacker .po-admin-options::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 255, 102, 0.6);
}

body.hacker .po-stat-tile {
    background: rgba(0, 255, 102, 0.07);
    box-shadow: inset 0 0 0 1px rgba(0, 255, 102, 0.25);
}

body.hacker .po-stat-val {
    color: #b9ffd2;
}

body.hacker .po-stat-label,
body.hacker .po-stat-val small {
    color: #7fdca3;
}

/* edit-odds modal - it only opens in Edit Mode, so it always gets the terminal greens */
body.hacker .po-modal {
    background: #03150a;
    border-color: rgba(0, 255, 102, 0.35);
    box-shadow: 4px 4px rgba(0, 0, 0, 0.35), 0 0 18px rgba(0, 255, 102, 0.12);
    color: #b9ffd2;
}

body.hacker .po-modal-title {
    color: #39ff88;
    text-shadow: 0 0 10px rgba(57, 255, 136, 0.55);
}

body.hacker .po-modal-sub,
body.hacker .po-edit-head,
body.hacker .po-edit-default,
body.hacker .po-edit-note {
    color: #7fdca3;
}

body.hacker .po-modal-close {
    background: rgba(0, 255, 102, 0.1);
    color: #b9ffd2;
}

body.hacker .po-modal-close:hover {
    background: #39ff88;
    color: #03150a;
}

body.hacker .po-edit-list {
    border-color: rgba(0, 255, 102, 0.35);
    background-color: #010a04;
}

body.hacker .po-edit-row.changed {
    background: rgba(57, 255, 136, 0.12);
}

body.hacker .po-edit-input {
    background: #03150a;
    box-shadow: inset 0 0 0 1px rgba(0, 255, 102, 0.35);
    color: #39ff88;
}

body.hacker .po-edit-input:focus {
    outline-color: #39ff88;
}

body.hacker .po-btn {
    --bg: #00d455;
    color: #03150a;
    text-shadow: none;
    box-shadow: inset 0 -4px rgba(0, 0, 0, 0.25), 0 0 10px rgba(0, 255, 102, 0.4);
}

body.hacker .po-btn-ghost {
    --bg: rgba(0, 255, 102, 0.1);
    color: #b9ffd2;
    box-shadow: inset 0 0 0 1px rgba(0, 255, 102, 0.35);
}

/* the sweep: the new look wipes in from the left over a snapshot of the old one, with its
   leading edge tilted 15deg - across the full screen height that edge leans tan(15deg) ~ 26.8%
   of the height, so it runs that far past the right edge to finish covering the screen */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

::view-transition-new(root) {
    animation: po-sweep 0.6s cubic-bezier(0.65, 0, 0.35, 1) both;
}

@keyframes po-sweep {
    from {
        clip-path: polygon(0 0, 0 0, -26.8vh 100%, 0 100%);
    }

    to {
        clip-path: polygon(0 0, calc(100% + 26.8vh) 0, 100% 100%, 0 100%);
    }
}
