/* Account Calculator — page layout.
   Reuses base.css tokens/classes, plus the segmented toggle (.acToggle) and
   amount box (.acRow / .acAmountBox) from advanced-calculator.css. Only the
   top bar, the 2/3 + 1/3 shell and the pack / blook tiles live here. */

/* ── Top bar: Locker/Stats toggle + account button ── */
.avHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.avViewToggle {
    width: auto;
    min-width: 17rem;
    font-family: var(--font-heading);
    font-size: calc(0.9rem + 0.4vw);   /* matches the account button */
}

.avViewToggle .acToggle-option:not(.active) { text-shadow: 2px 2px rgba(0, 0, 0, 0.2); }

/* Top bar, left side: the toggle, then Sync Locker sized like one of its halves */
.avHeader-left {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
    min-width: 0;
}

.avSyncBtn {
    min-width: 8.5rem;
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 0.75rem;
    background: #5bbe21;
    color: #fff;
    font-family: var(--font-heading);
    font-size: calc(0.9rem + 0.4vw);
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    cursor: pointer;
    transition: filter 0.15s, transform 0.15s;
}

.avSyncBtn:hover { filter: brightness(1.1); }
.avSyncBtn:active { transform: scale(0.96); }

.avAccount {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    max-width: 100%;
    padding: 0.35rem 1rem 0.35rem 0.5rem;
    border: none;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    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: transform 0.15s, background 0.15s;
}

.avAccount:hover { transform: scale(1.04); background: rgba(255, 255, 255, 0.3); }
.avAccount:active { transform: scale(0.97); }

.avAccount img {
    width: 2.2rem;
    height: 2.2rem;
    object-fit: contain;
    filter: drop-shadow(2px 2px rgba(0, 0, 0, 0.2));
}

.avAccount span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Shell: locker on the left, a narrower summary column on the right (5:2) ── */
.avContent {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    width: 100%;
    align-items: flex-start;
}

.avMain {
    flex: 5;
    min-width: 0;
}

.avSide {
    flex: 2.5;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ── Summary card: Blook Score, unique blooks per rarity, totals ── */
/* The Blook Score and its tier badge are centred on the card's top edge: half
   above the card, half inside it. The card sits lower to leave room for the
   top half, and its top padding clears the bottom half. (Percentages are of
   the column's width; the card is 84% of that, and the badge is sized from
   the card.) The side margins narrow the card without taking any width from
   the locker beside it. */
.avSummary {
    margin: 34% 8% 0;
    align-items: stretch;   /* .purpleblock centres its children */
    gap: 1.5rem;
    padding: 27% 1.25rem 1.5rem;
    font-family: var(--font-main);
    color: #fff;
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
}

/* Blook backdrop over the card's purple, under its content. It reuses
   .bgBlooks from base.css (same image and 15° tilt, but still) and is clipped by
   this wrapper rather than the card, so the score badge can still overhang. */
.avSummary { isolation: isolate; }

.avSummary-bg {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    border-radius: calc(1rem - 6px);   /* the card's radius, inside its border */
    pointer-events: none;
}

.avSummary-bg .bgBlooks {
    position: absolute;
    opacity: 0.05;
    background-size: 500px;   /* smaller blooks than the page's 1200px */
    animation: none;
}

.avScore,
.avTotal {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
}

/* The score sits in the middle of its tier badge. The badge art is square
   with its emblem centred, and is sized off the card: a bit wider than the
   card's outer edge. */
.avScore {
    position: absolute;
    top: -6px;   /* the card's border: centres on its outer edge */
    left: 1.25rem;
    right: 1.25rem;
    transform: translateY(-50%);
    text-shadow: 2px 3px rgba(0, 0, 0, 0.35);
}

.avScore-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    width: calc(118% + 3.8rem);
    max-width: none;
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.avScore-num,
.avScore-label { position: relative; }   /* above the badge */

/* the score is the one thing on the card in the heading font */
.avScore-num {
    font-family: var(--font-heading);
    font-size: calc(1.6rem + 1.2vw);
}

.avRarity span,
.avTotal-num { font-weight: bold; }

.avScore-label,
.avTotal-label {
    font-family: var(--font-main);
    font-size: calc(0.8rem + 0.3vw);
}

.avRarities {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem 0.5rem;
}

.avRarity {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    font-size: calc(0.9rem + 0.4vw);
}

.avRarity img {
    width: 2.4rem;
    height: 2.4rem;
    object-fit: contain;
}

.avSummary-rule {
    height: 2px;
    margin: 0 1rem;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.avTotals {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
}

.avTotal-num {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: calc(1.2rem + 0.8vw);
}

.avTotal-num img {
    width: 1em;
    height: 1em;
    filter: drop-shadow(2px 2px rgba(0, 0, 0, 0.2));
}

/* ── Top bar, right side: token input sits left of the account button ── */
.avHeader-right {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
    min-width: 0;
}

.avTokens {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.9rem 0.35rem 0.6rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 0.75rem;
    cursor: text;
    transition: background 0.15s;
}

.avTokens:focus-within { background: rgba(255, 255, 255, 0.3); }

.avTokens img {
    flex: 0 0 auto;
    width: 1.8rem;
    height: 1.8rem;
    filter: drop-shadow(2px 2px rgba(0, 0, 0, 0.2));
}

.avTokens input {
    width: 9ch;
    min-width: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-family: var(--font-heading);
    font-size: calc(0.9rem + 0.4vw);   /* matches the account button */
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
    text-align: left;
    -moz-appearance: textfield;
    appearance: textfield;
}

.avTokens input:focus { outline: none; }

.avTokens input::placeholder {
    color: rgba(255, 255, 255, 0.65);
    opacity: 1;
}

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


/* ── Pack sections ── */
/* The pack list scrolls inside its own box rather than stretching the page */
.avPacks {
    display: flex;
    flex-direction: column;
    gap: 2.25rem;
    align-items: stretch;   /* .purpleblock centres its children */
    max-height: 70vh;
    overflow-y: auto;
    padding: 1.25rem;
}

/* The bar is inset from the box's edge: a transparent border around the track
   and thumb, with the fill clipped inside it, leaves a gap on every side. */
.avPacks::-webkit-scrollbar { width: 1.4rem; }
.avPacks::-webkit-scrollbar-track,
.avPacks::-webkit-scrollbar-thumb {
    border: 0.4rem solid transparent;
    border-radius: 1rem;
    background-clip: padding-box;
}
.avPacks::-webkit-scrollbar-track { background-color: rgba(255, 255, 255, 0.1); }
.avPacks::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, 0.4); }

.avPacks[hidden],
.avStats[hidden] { display: none; }

.avPack {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* The heading sits on a faint pattern of the pack's icon, which runs the full
   width and a little past the white underline. The underline is drawn as its
   own layer so it stays solid white on top of the pattern. */
.avPack-head {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: calc(0.4rem + 4px);
}

.avPack-head::after {   /* underline runs the full width of the section */
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    border-radius: 2px;
    background: #fff;
}

.avPack-pattern {
    position: absolute;
    top: -0.5rem;
    left: 0;
    width: 100%;
    height: 68px;   /* exactly the pattern's two rows (see packPattern) */
    opacity: 0.15;
    pointer-events: none;
}

.avPack-name,
.avPack-add { position: relative; }   /* above the pattern */

.avPack-name {
    text-align: left;
    margin-bottom: 0;   /* calculator.css gives every h2 a 1rem bottom margin */
    line-height: 1.15;
}

.avPack-add {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    padding: 0.45rem;
    border: none;
    border-radius: 0.6rem;
    background: rgba(255, 255, 255, 0.65);
    color: var(--purple);
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
}

.avPack-add svg {
    display: block;
    width: 100%;
    height: 100%;
}

.avPack-add:hover { transform: scale(1.08); background: rgba(255, 255, 255, 0.9); }
.avPack-add:active { transform: scale(0.94); }

/* Tiles stretch so each row fills the section edge to edge: as many columns
   as fit at --tile or wider, sharing whatever width is left over. */
.avPack-blooks {
    --tile: 4.25rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--tile), 1fr));
    gap: 0.75rem;
}

/* ── Blook tiles: dimmed until owned, count in the corner ── */
.avBlook {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    transition: transform 0.15s;
}

.avBlook:hover { transform: scale(1.08); }
.avBlook:active { transform: scale(0.96); }

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

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

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

/* One place maps a rarity to its colour; count badges, bars, pie slices and
   legend swatches all read --rarity. */
[data-rarity="Common"]    { --rarity: #9aa0a6; }
[data-rarity="Uncommon"]  { --rarity: var(--uncommon); }
[data-rarity="Rare"]      { --rarity: var(--rare); }
[data-rarity="Epic"]      { --rarity: var(--epic); }
[data-rarity="Legendary"] { --rarity: var(--legendary); }
[data-rarity="Chroma"]    { --rarity: var(--chroma); }
[data-rarity="Mystical"]  { --rarity: var(--mystical); }
[data-rarity="Unique"]    { --rarity: var(--unique); }

.avBlook-count[data-rarity] { background: var(--rarity); }

/* ── Stats tab ── */
/* Stats takes the whole width: Account Stats across the top, then Your Blooks
   on the left beside By Rarity and Next Blooks to Get stacked on the right.
   The right column is locker-only. */
.avContent.stats-view .avSide { display: none; }

.avStats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.avStats > .avPanel:first-child { grid-column: 1 / -1; }

.avPanel {
    align-items: stretch;   /* .purpleblock centres its children */
    gap: 1rem;
    padding: 1.25rem;
    font-family: var(--font-heading);
    color: #fff;
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
}

/* The underline is a pseudo-element rather than a border so its ends can be rounded. */
.avPanel-title {
    position: relative;
    margin-bottom: 0;   /* calculator.css gives every h2 a 1rem bottom margin */
    padding-bottom: calc(0.4rem + 4px);
    text-align: left;
    line-height: 1.15;
}

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

/* A title with a control on its right: the row carries the underline, so the
   control sits above the line too. */
.avPanel-head {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: calc(0.4rem + 4px);
}

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

.avPanel-head .avPanel-title { padding-bottom: 0; }
.avPanel-head .avPanel-title::after { content: none; }
.avPanel-head .avSeg { flex: 0 0 auto; flex-wrap: nowrap; }

.avPanel-note,
.avEmpty {
    font-family: var(--font-main);
    font-size: 0.95rem;
    opacity: 0.85;
}

.avPanel-note { margin-top: -0.4rem; }
.avEmpty { padding: 1.5rem 0; text-align: center; }

/* totals */
.avTiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 0.6rem;
}

.avTile {
    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;
}

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

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

.avTile-val small,
.avRarityCol small {
    font-family: var(--font-main);
    font-size: 0.6em;
    opacity: 0.8;
}

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

/* collected / missing per rarity: one column per rarity, side by side */
.avRarityTable {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
    gap: 0.6rem;
}

.avRarityCol {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.75rem 0.4rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    text-align: center;
}

.avRarityCol img {
    width: 2.2rem;
    height: 2.2rem;
    object-fit: contain;
}

.avRarityCol-name { font-size: 1.05rem; }

.avRarityCol-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.avRarityCol-val { font-size: 1.3rem; }

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

/* segmented controls (bar sort, pie mode) */
.avSeg {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.avSeg button {
    padding: 0.4rem 0.9rem;
    border: none;
    border-radius: 0.6rem;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s;
}

/* two control groups on one row: main one left, secondary one right */
.avSegRow {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.4rem 1rem;
}

.avSeg-label { align-self: center; }

/* sort-order button: icon only, as tall as the text buttons beside it */
.avSeg .avOrderBtn {
    display: flex;
    align-items: center;
    padding: 0.3rem 0.7rem;
}

.avOrderBtn svg { width: 1.5rem; height: 1.5rem; }

.avSeg button:hover { background: rgba(255, 255, 255, 0.25); }

.avSeg button.active {
    background: #fff;
    color: var(--purple);
}

/* owned blooks as horizontal bars — ten rows show, the rest scroll */
.avBars {
    --row: 3rem;
    --gap: 0.3rem;
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    max-height: calc(10 * var(--row) + 9 * var(--gap));
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Side by side with By Rarity, the bar list stops setting its own height:
   it contributes (almost) nothing to the row, so By Rarity decides how tall
   both panels are, and the list fills what's left and scrolls. Stacked on
   small screens it keeps the ten-row height above. */
@media only screen and (min-width: 769px) {
    .avBars:not(.avBars-fixed) {
        flex: 1 1 0;
        min-height: 6rem;
        max-height: none;
    }

    /* Your Blooks runs down the left past both right-hand panels */
    .avStats > .avPanel:nth-child(2) { grid-row: span 2; }
}

/* Next Blooks to Get always sets its own height: six rows, the rest scroll */
.avBars-fixed { max-height: calc(6 * var(--row) + 5 * var(--gap)); }

.avBars::-webkit-scrollbar,
.avAcct-list::-webkit-scrollbar,
.avAcct-picker::-webkit-scrollbar { width: 0.6rem; }

.avBars::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
}

.avBars::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.4);
    border-radius: 1rem;
}

.avBar {
    flex: 0 0 var(--row);
    display: grid;
    grid-template-columns: 2.6rem minmax(5rem, 11rem) 1fr minmax(5rem, auto);
    align-items: center;
    gap: 0.6rem;
    padding: 0 0.4rem;
    border: none;
    border-radius: 0.6rem;
    background: none;
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1.15rem;
    text-align: left;
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.avBar:hover { background: rgba(255, 255, 255, 0.1); }

.avBar img {
    width: 2.6rem;
    height: 2.6rem;
    object-fit: contain;
    filter: drop-shadow(3px 3px rgba(0, 0, 0, 0.25));
}

/* Your Blooks rows carry the locker's count badge, a little smaller */
.avBar-icon {
    position: relative;
    display: block;
    height: 2.6rem;
}

.avBar-icon .avBlook-count {
    left: -0.3rem;
    bottom: -0.15rem;
    min-width: 1.1rem;
    padding: 0 0.2rem;
    font-size: 0.68rem;
    line-height: 1.1rem;
}

.avBar-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.avBar-track {
    display: block;
    height: 1.1rem;
}

/* Each bar is shaded from its own rarity colour: a darker outline, a slightly
   darker bottom half, and a short drop shadow straight down. */
.avBar-fill {
    --bar-low: color-mix(in srgb, var(--rarity) 82%, #000);
    --bar-edge: color-mix(in srgb, var(--rarity) 55%, #000);
    display: block;
    min-width: 3px;
    height: 100%;
    background: linear-gradient(var(--rarity) 50%, var(--bar-low) 50%);
    border-radius: 0 4px 4px 0;
    box-shadow:
        0 0 0 2px var(--bar-edge),
        0 3px 0 2px rgba(0, 0, 0, 0.25);
}

.avBar-val {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.3rem;
    white-space: nowrap;
}

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

/* pie + legend */
/* Legend sits to the right of the pie; it only drops beneath when the panel
   itself is too narrow for both (mid-size screens, where the two stats
   panels are squeezed side by side, and small phones). */
.avPieWrap { container-type: inline-size; }

.avPie {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1.5rem;
}

/* Fixed width, so the pie stays the same size whatever the legend's width
   is for the current filter. */
.avPie-svg {
    flex: 0 0 13rem;
    width: 13rem;
    height: auto;
    overflow: visible;
    filter: drop-shadow(5px 7px rgba(0, 0, 0, 0.3));
}

.avPie-legend { flex: 0 0 auto; }

@container (max-width: 35rem) {
    .avPie { flex-direction: column; align-items: flex-start; }
    .avPie-svg { flex: 0 0 auto; width: min(16rem, 100%); }
}

.avPie-svg [data-rarity] { fill: var(--rarity); }

/* Side wall of the 3D disc: halfway between two ways of darkening the slice's
   colour — mixing in black (greyer) and lowering lightness at full saturation
   (richer). Older browsers fall back to a mix with a near-black indigo. */
.avPie-svg .avPie-wall { fill: color-mix(in oklab, var(--rarity) 72%, #120a26); }

@supports (color: oklch(from red l c h)) {
    .avPie-svg .avPie-wall {
        fill: color-mix(in oklab,
            oklch(from var(--rarity) calc(l * 0.72) calc(c * 1.15) h),
            color-mix(in srgb, var(--rarity) 72%, #000));
    }
}

.avPie-outline {
    fill: none;
    stroke: #fff;
    stroke-width: 3;
    stroke-linejoin: round;
    pointer-events: none;
}

.avPie-label {
    fill: #fff;
    font-family: var(--font-main);
    font-size: 11px;
    font-weight: bold;
    text-anchor: middle;
    dominant-baseline: central;
    text-shadow: none;
    stroke: rgba(0, 0, 0, 0.45);
    stroke-width: 2.5px;
    paint-order: stroke fill;
    pointer-events: none;
}

.avPie-legend {
    display: grid;
    grid-template-columns: auto auto auto auto;
    align-items: center;
    gap: 0.45rem 0.9rem;
    font-size: 1.05rem;
}

.avPie-row { display: contents; }

.avPie-swatch {
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
    background: var(--rarity);
    box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.85);
}

.avPie-val {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.3rem;
}

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

.avPie-pct {
    font-family: var(--font-main);
    text-align: right;
    opacity: 0.85;
}

/* calculator.css stops at Chroma */
.rarity-Mystical { background: var(--mystical); }
.rarity-Unique   { background: var(--unique); }

/* ── Pack editor modal ── */
.avEdit-grid { margin-top: 1rem; }

.blook-row.avEdit { cursor: default; }

.avEdit .rarity-tag {
    display: inline-block;
    margin-top: 0.15rem;
    font-size: 0.8rem;
}

/* ── Account modal ── */
.avAccountModal { width: min(30rem, 90vw); }

.avAcct {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
    color: #fff;
}

.avAcct-intro,
.avAcct-hint {
    font-family: var(--font-main);
    text-align: center;
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
}

.avAcct-hint {
    margin-top: -0.4rem;
    font-size: 0.85rem;
    opacity: 0.85;
}

.avAcct-current,
.avAcct-form {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.avAcct input[type="text"] {
    flex: 1;
    min-width: 0;
    height: 2.75rem;
    padding: 0 0.9rem;
    border: none;
    border-radius: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1.15rem;
}

.avAcct input[type="text"]:focus { outline: 2px solid #fff; }

.avAcct input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.65);
    opacity: 1;
}

.avAcct-avatar {
    flex: 0 0 auto;
    width: 4rem;
    height: 4rem;
    padding: 0.3rem;
    border: none;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
}

.avAcct-avatar:hover { transform: scale(1.06); background: rgba(255, 255, 255, 0.3); }

.avAcct-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(2px 2px rgba(0, 0, 0, 0.2));
}

.avAcct-btn {
    flex: 0 0 auto;
    height: 2.75rem;
    padding: 0 1.25rem;
    border: none;
    border-radius: 0.75rem;
    background: var(--green);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1.15rem;
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: filter 0.15s, transform 0.15s;
}

.avAcct-btn:hover { filter: brightness(1.1); }
.avAcct-btn:active { transform: scale(0.96); }

/* blook chooser for the account's preview */
/* Tiles stretch so each row fills the box edge to edge: as many columns as
   fit at 3.5rem or wider, sharing whatever width is left over. */
.avAcct-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(3.5rem, 1fr));
    gap: 0.35rem;
    max-height: 17rem;
    overflow-y: auto;
    padding: 0.5rem;
    border-radius: 0.75rem;
    background: rgba(0, 0, 0, 0.12);
}

.avAcct-picker[hidden] { display: none; }

.avAcct-picker button {
    width: 100%;
    aspect-ratio: 1;
    padding: 0.2rem;
    border: 2px solid transparent;
    border-radius: 0.5rem;
    background: none;
    cursor: pointer;
}

.avAcct-picker button:hover { background: rgba(255, 255, 255, 0.2); }
.avAcct-picker button.active { border-color: #fff; background: rgba(255, 255, 255, 0.2); }

.avAcct-picker img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.modal .avAcct-heading {
    margin: 0.4rem 0 0;
    font-size: 1.2rem;
    text-align: left;
}

.avAcct-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 14rem;
    overflow-y: auto;
}

/* one saved account: the account itself, then its delete control */
.avAcct-row {
    flex-shrink: 0;
    display: flex;
    gap: 0.4rem;
}

.avAcct-del {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2.75rem;
    padding: 0 0.7rem;
    border: none;
    border-radius: 0.75rem;
    background: rgba(0, 0, 0, 0.1);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1rem;
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: background 0.15s;
}

.avAcct-del svg { width: 1.3rem; height: 1.3rem; }
.avAcct-del:hover { background: rgba(0, 0, 0, 0.25); }
.avAcct-del.confirm { background: #d93636; }
.avAcct-del.confirm:hover { background: #c22a2a; }

.avAcct-item {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.75rem;
    border: 3px solid transparent;
    border-radius: 0.75rem;
    background: rgba(0, 0, 0, 0.1);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    text-align: left;
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: background 0.15s;
}

.avAcct-item:hover { background: rgba(0, 0, 0, 0.18); }
.avAcct-item.active { border-color: #fff; background: rgba(0, 0, 0, 0.18); }

.avAcct-item img {
    width: 2.2rem;
    height: 2.2rem;
    object-fit: contain;
}

.avAcct-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Sync modal: Party Pig on the left, then the steps and Open Blooket Data / Sync ── */
.avSyncModal { width: min(42rem, 90vw); }

.avSync {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.avSync-pig {
    flex: 0 0 auto;
    width: 10rem;
    height: 10rem;
    object-fit: contain;
    filter: drop-shadow(5px 6px rgba(0, 0, 0, 0.25));
}

.avSync-main {
    flex: 1;
    min-width: 0;
}

.avSync-steps {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding-left: 1.5rem;
    font-family: var(--font-main);
    text-shadow: 2px 2px rgba(0, 0, 0, 0.2);
}

.avSync-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.avSync-actions .avAcct-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    text-decoration: none;
}

.avSync-open { background: rgba(255, 255, 255, 0.25); }

.avSync-status {
    padding: 0.6rem 0.8rem;
    border-radius: 0.75rem;
    background: rgba(0, 0, 0, 0.18);
    font-family: var(--font-main);
    text-align: center;
}

.avSync-status:empty { display: none; }

/* ── Single-blook modal ── */
.avBlookModal { width: min(26rem, 90vw); }

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

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

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

.avDetail-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);
    color: #fff;
    text-align: center;
}

/* a lone "Obtained from" stat spans the row */
.avDetail-stat:first-child:nth-last-child(odd) { grid-column: span 2; }

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

.avDetail-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);
}

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

.avStepper {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.avStepper button {
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.85);
    color: var(--gray);
    font-family: var(--font-heading);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
}

.avStepper button:hover { background: #fff; transform: scale(1.08); }
.avStepper button:active { transform: scale(0.94); }

.avStepper input {
    width: 3.5rem;
    height: 2rem;
    border: none;
    border-radius: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    text-align: center;
    -moz-appearance: textfield;
    appearance: textfield;
}

.avStepper input:focus { outline: 2px solid #fff; }

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

/* ── Responsive ── */
@media only screen and (max-width: 768px) {
    .avContent { flex-direction: column; }
    .avMain,
    .avSide {
        flex: unset;
        width: 100%;
    }
    /* no room beside the steps: the pig sits above them, smaller */
    .avSync { flex-direction: column; gap: 0.5rem; }
    .avSync-pig { width: 6rem; height: 6rem; }
    .avHeader,
    .avHeader-left,
    .avHeader-right { flex-wrap: wrap; justify-content: center; }
    .avStats { grid-template-columns: minmax(0, 1fr); }
    .avPack-blooks { --tile: 3.5rem; }
    /* full-width card: keep the badge inside the page instead of past its edges */
    .avSummary { margin: min(36%, 9.5rem) 0 0; padding-top: min(27%, 7rem); }
    .avScore-badge { width: min(100% + 2rem, 26rem); }
}
