/* Match the purple header without changing the existing game grid. */
.shop-button {
    padding: 0;
    border: 0;
    background: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.shop-button:hover {
    transform: scale(1.15);
}

body:has(.shop[open]) {
    overflow: hidden;
}

/* The shop floats above the page; the backdrop dims the game cards. */
.shop {
    width: min(1000px, calc(100% - 24px));
    max-height: calc(100dvh - 32px);
    padding: 28px;
    border: 2px solid var(--brand);
    border-radius: 20px;
    color: #f5f0ff;
    background: #141021;
    box-shadow: 0 24px 100px #0009;
}

.shop::backdrop {
    background: #050713cc;
}

.shop-header,
.shop-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.shop-kicker {
    margin: 0 0 8px;
    color: #c4a0e0;
    font: bold 0.7rem monospace;
    letter-spacing: 0.16em;
}

.shop h2 {
    margin: 0;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.3rem, 5vw, 2rem);
}

.shop-close,
.shop-arrows button {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border: 1px solid #674780;
    border-radius: 10px;
    background: #281d39;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
}

.shop-toolbar {
    margin-top: 24px;
}

.coin-balance {
    margin: 0;
    padding: 12px 16px;
    border: 1px solid #64502c;
    border-radius: 30px;
    color: var(--reward);
    background: #30271b;
}

.coin-balance strong {
    font-size: 1.2rem;
}

.shop-arrows {
    display: flex;
    gap: 8px;
}

.shop-intro {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Fixed card widths and no wrapping give us exactly one scrollable row. */
.design-row {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--space-md);
    overflow-x: auto;
    padding: 8px 3px 18px;
    scroll-snap-type: x proximity;
    scrollbar-color: var(--brand) #241930;
    scrollbar-width: auto;
    overscroll-behavior-x: contain;
}

.design-card {
    flex: 0 0 194px;
    padding: 18px;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-card);
    background: var(--surface);
    text-align: center;
    scroll-snap-align: start;
}

.design-card h3 {
    margin: 18px 0 8px;
    font-size: 1rem;
}

.design-card.is-equipped {
    border-color: var(--reward);
    box-shadow: inset 0 0 0 1px var(--reward);
}

.design-price {
    color: var(--reward);
    margin: 0 0 16px;
}

.design-buy {
    width: 100%;
    padding: 11px 8px;
    border: 0;
    border-radius: 8px;
    background: #a66ed2;
    color: #110b1b;
    font-weight: bold;
    cursor: pointer;
}

.shop button:disabled {
    opacity: 0.5;
    cursor: default;
}

.shop button:not(:disabled):hover {
    filter: brightness(1.2);
}

.shop :focus-visible,
.shop-button:focus-visible {
    outline: 3px solid var(--reward);
    outline-offset: 3px;
}

.shop-status {
    min-height: 2.6em;
    margin: 16px 0 0;
    color: var(--text-soft);
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Canvas previews use the same cached artwork as gameplay. */
.square-preview {
    display: block;
    image-rendering: pixelated;
    width: 100px;
    height: 100px;
    margin: 6px auto;
    border-radius: 5px;
    border: 2px solid #ffffff55;
    box-shadow: 0 10px 20px #0005;
}

@media (max-width: 520px) {
    .shop {
        padding: 18px;
    }

    .design-card {
        flex-basis: 170px;
        padding: 14px;
    }

    .shop-toolbar {
        gap: 8px;
    }
}
