/*
 * The coin shop sheet (server: htmx/webApp/coinShop/), drawn like the phone's CoinShopBottomSheet:
 * the balance pill and ✕ in one pinned row, "Get more coins", the gold shortfall card, three pack
 * rows (the best-value one with a red outline, a filled price button and the yellow ribbon), the
 * "Use coins for" chips and the one-time payment note. At every width it is a bottom sheet capped
 * at 640 px like the other web sheets (web-app-bottom-sheets.css); colours are the phone's tokens.
 */

.wa-coin-shop { padding-bottom: var(--wa-bottom-inset); }

/* the pinned row: the balance (shown only) and the ✕, lined up with the packs' edges */
.wa-coin-shop__top-row {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 8px 0 20px;
}
.wa-coin-shop__close { width: 48px; height: 48px; color: var(--md-on-surface-variant); }
.wa-coin-shop__close .wa-icon svg { width: 24px; height: 24px; }

.wa-coin-shop__scroll { padding: 0 20px 24px; }
.wa-coin-shop__column { display: flex; flex-direction: column; padding-top: 24px; }

/* "Get more coins": headlineSmall bold, one line */
.wa-coin-shop__title {
    margin: 0;
    color: var(--md-on-surface);
    font-size: calc(24px * var(--wa-text-scale, 1));
    font-weight: 700;
    line-height: 1.33;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wa-coin-shop__subtitle {
    margin: 4px 0 20px;
    color: var(--md-on-surface-variant);
    font-size: calc(14px * var(--wa-text-scale, 1));
    line-height: 1.43;
}

/* the phone's CoinShopContextFocusCard: secondary gold at 12% with a 45% outline */
.wa-coin-shop__focus-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    padding: 20px 16px;
    border-radius: 16px;
    background: color-mix(in srgb, var(--md-secondary) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--md-secondary) 45%, transparent);
}
.wa-coin-shop__focus-card-icon {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--md-secondary);
    color: var(--md-on-secondary);
}
.wa-coin-shop__focus-card-icon .wa-icon svg { width: 20px; height: 20px; }
.wa-coin-shop__focus-card-text {
    margin: 0;
    color: var(--md-on-surface);
    font-size: calc(16px * var(--wa-text-scale, 1));
    font-weight: 600;
    line-height: 1.5;
}

/* the packs: one row each, 12 px apart */
.wa-coin-shop__packs { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.wa-coin-shop__pack {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px;
    border-radius: 16px;
    border: 1px solid var(--md-outline-variant);
    background: var(--md-background);
}
/* the best-value pack: a stronger primary outline, a touch lighter, room above for its ribbon */
.wa-coin-shop__pack--best-value {
    margin-top: 12px;
    border: 2px solid var(--wa-primary);
    background: var(--md-surface-container-lowest);
}
.wa-coin-shop__best-value-tag {
    position: absolute;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--md-secondary);
    color: var(--md-on-secondary);
    font-size: calc(11px * var(--wa-text-scale, 1));
    font-weight: 600;
    white-space: nowrap;
}

/* the fanned coins: one, two or three, 12 px apart and tilted 16° each from the middle */
.wa-coin-shop__coin-stack { position: relative; flex: none; width: 48px; height: 48px; }
.wa-coin-shop__stack-coin {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 36px;
    height: 36px;
}
.wa-coin-shop__coin-stack--2 .wa-coin-shop__stack-coin:nth-child(1) { transform: translateX(-6px) rotate(-8deg); }
.wa-coin-shop__coin-stack--2 .wa-coin-shop__stack-coin:nth-child(2) { transform: translateX(6px) rotate(8deg); }
.wa-coin-shop__coin-stack--3 .wa-coin-shop__stack-coin:nth-child(1) { transform: translateX(-12px) rotate(-16deg); }
.wa-coin-shop__coin-stack--3 .wa-coin-shop__stack-coin:nth-child(3) { transform: translateX(12px) rotate(16deg); }

.wa-coin-shop__pack-text { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; }
.wa-coin-shop__pack-coins {
    color: var(--md-on-surface);
    font-size: calc(16px * var(--wa-text-scale, 1));
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wa-coin-shop__pack-label {
    color: var(--md-on-surface-variant);
    font-size: calc(12px * var(--wa-text-scale, 1));
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wa-coin-shop__pack--best-value .wa-coin-shop__pack-label { color: var(--wa-primary); }

/* the price buttons: one width so the three line up on the right */
.wa-coin-shop__price-button { position: relative; flex: none; width: 102px; padding-left: 8px; padding-right: 8px; }
.wa-coin-shop__price-button--outlined {
    background: transparent;
    border-color: var(--md-outline);
    color: var(--md-on-surface);
}
/* the tapped pack spins until the checkout opens; the others wait, dimmed */
.wa-coin-shop__packs[data-web-coin-shop-busy] { pointer-events: none; }
.wa-coin-shop__packs[data-web-coin-shop-busy] .wa-coin-shop__price-button:not(.is-purchasing) { opacity: 0.55; }
.wa-coin-shop__price-button.is-purchasing .wa-coin-shop__price-text { visibility: hidden; }
.wa-coin-shop__price-button.is-purchasing::after {
    content: "";
    position: absolute;
    top: calc(50% - 10px);
    left: calc(50% - 10px);
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: wa-spin 800ms linear infinite;
}

/* "Use coins for" and the read-only chips, centred, wrapping on narrow screens */
.wa-coin-shop__spend { display: flex; flex-direction: column; align-items: center; margin-top: 20px; }
.wa-coin-shop__spend-label {
    margin: 0 0 8px;
    color: var(--md-on-surface-variant);
    font-size: calc(12px * var(--wa-text-scale, 1));
    font-weight: 500;
    text-align: center;
}
.wa-coin-shop__spend-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.wa-coin-shop__spend-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--md-outline-variant);
    color: var(--md-on-surface);
    font-size: calc(12px * var(--wa-text-scale, 1));
    font-weight: 500;
    white-space: nowrap;
}
.wa-coin-shop__spend-chip .wa-icon { color: var(--md-on-surface-variant); }
.wa-coin-shop__spend-chip .wa-icon svg { width: 16px; height: 16px; }

.wa-coin-shop__one-time-note {
    margin: 24px 0 0;
    color: var(--md-on-surface-variant);
    font-size: calc(12px * var(--wa-text-scale, 1));
    font-weight: 500;
    text-align: center;
}

.wa-coin-shop__close:focus-visible,
.wa-coin-shop__price-button:focus-visible { outline: 2px solid var(--wa-focus-ring); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    .wa-coin-shop__price-button.is-purchasing::after { animation-duration: 2400ms; }
}
