.mapleup-store-layout {
    display: flex;
    align-items: center;
}

.mapleup-store-frame {
    max-width: 1120px;
    padding: 0;
    overflow: hidden;
    border-radius: var(--radius-sm);
}

.mapleup-store-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.mapleup-store-topbar-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    min-width: 0;
}

.mapleup-store-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
    min-height: 620px;
}

.mapleup-store-hero,
.mapleup-store-panel {
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--bg-elevated);
}

.mapleup-store-hero {
    border-right: 1px solid var(--border);
}

.mapleup-store-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset;
}

.mapleup-store-products-panel,
.mapleup-store-form-panel {
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.mapleup-store-products-panel {
    flex: 1;
}

.mapleup-store-form-panel {
    position: sticky;
    top: 1.4rem;
}

.mapleup-store-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}

.mapleup-store-section-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
}

.mapleup-store-section-note,
.mapleup-store-form-note {
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.7;
}

.mapleup-store-section-note {
    margin-bottom: 0.9rem;
}

.mapleup-store-form-note {
    margin-bottom: 0.85rem;
}

.mapleup-store-selected {
    margin-bottom: 0.85rem;
    padding: 0.8rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.6;
}

.mapleup-store-product-grid,
.mapleup-store-form {
    display: grid;
}

.mapleup-store-product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

.mapleup-store-product-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr auto;
    gap: 0.45rem;
    align-content: start;
    width: 100%;
    min-height: 144px;
    padding: 0.58rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-elevated);
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.mapleup-store-product-card:hover,
.mapleup-store-product-card.is-active {
    border-color: var(--border-hover);
    background: var(--surface-hover);
    box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.12);
}

.mapleup-store-product-card:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.mapleup-store-product-card-media {
    width: 100%;
    aspect-ratio: 16 / 7;
    height: auto;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    box-sizing: border-box;
}

.mapleup-store-product-card-media img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.mapleup-store-product-card-placeholder {
    font-size: 10px;
    color: var(--text-tertiary);
}

.mapleup-store-product-card-body {
    display: grid;
    align-content: start;
    gap: 0.14rem;
    min-width: 0;
}

.mapleup-store-product-card-body strong {
    color: var(--text);
    font-size: 0.72rem;
    line-height: 1.3;
}

.mapleup-store-product-card-body span {
    color: var(--text-secondary);
    font-size: 0.64rem;
    line-height: 1.35;
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.mapleup-store-product-card-meta {
    color: var(--text-tertiary);
    margin-top: 0;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
}

.mapleup-store-product-card-side {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    min-width: 0;
}

.mapleup-store-product-card-side-main {
    display: inline-flex;
    align-items: baseline;
    gap: 0.28rem;
    min-width: 0;
}

.mapleup-store-product-card-price {
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.mapleup-store-product-card-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 18px;
    padding: 0 0.34rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.mapleup-store-product-card.is-active .mapleup-store-product-card-state {
    border-color: rgba(88, 166, 255, 0.4);
    background: rgba(88, 166, 255, 0.12);
    color: var(--interactive-accent);
}

.mapleup-store-product-card:disabled .mapleup-store-product-card-state {
    color: var(--text-tertiary);
}

.mapleup-store-form {
    gap: 0.85rem;
}

.mapleup-store-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.mapleup-store-field span {
    color: var(--text);
    font-size: 0.76rem;
    font-weight: 600;
}

.mapleup-store-field input {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-elevated);
    color: var(--text);
    box-sizing: border-box;
    font: inherit;
}

.mapleup-store-field input:focus {
    outline: none;
    border-color: var(--border-hover);
    box-shadow: 0 0 0 1px var(--border-hover);
}

.mapleup-store-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.mapleup-store-submit {
    min-height: 40px;
    padding: 0 1rem;
    border: 0;
    border-radius: 10px;
    background: var(--primary-button-bg);
    color: var(--primary-button-text);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.mapleup-store-submit:hover:not(:disabled) {
    background: var(--primary-button-bg-hover);
    color: var(--primary-button-text);
}

.mapleup-store-submit:disabled {
    opacity: 0.56;
    cursor: not-allowed;
}

.mapleup-store-status {
    color: var(--text-secondary);
    font-size: 0.76rem;
    line-height: 1.6;
}

.mapleup-store-status.is-error {
    color: #f87171;
}

.mapleup-store-empty {
    padding: 1.1rem 0;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.7;
}

.mapleup-store-modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(1, 4, 9, 0.72);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
    z-index: 9999;
}

.mapleup-store-modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.mapleup-store-modal-dialog {
    width: min(860px, 100%);
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    box-shadow: var(--shadow-modal);
    overflow: hidden;
}

.mapleup-store-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--border);
}

.mapleup-store-modal-header h2 {
    margin: 0;
    color: var(--text);
    font-size: 1.05rem;
    line-height: 1.25;
}

.mapleup-store-modal-header p {
    margin: 0.45rem 0 0;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.6;
}

.mapleup-store-modal-close {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
}

.mapleup-store-modal-body {
    display: grid;
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
}

#mapleupStoreModal[data-payment-state="delivered"] .mapleup-store-modal-body {
    grid-template-columns: 1fr;
}

.mapleup-store-payment-qr {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    padding: 24px;
    border-right: 1px solid var(--border);
    background: var(--bg-elevated);
}

.mapleup-store-payment-qr img {
    width: min(220px, 100%);
    aspect-ratio: 1 / 1;
    display: block;
    border-radius: 16px;
    background: #fff;
    padding: 10px;
    box-sizing: border-box;
}

.mapleup-store-payment-content {
    display: grid;
    gap: 0.95rem;
    padding: 22px;
}

#mapleupStoreModal[data-payment-state="delivered"] .mapleup-store-payment-content {
    max-width: 100%;
}

.mapleup-store-payment-tip,
.mapleup-store-delivery-message {
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.7;
}

.mapleup-store-payment-delivery {
    padding: 14px;
    border: 1px solid rgba(46, 160, 67, 0.28);
    border-radius: 6px;
    background: rgba(46, 160, 67, 0.1);
}

.mapleup-store-payment-delivery h3 {
    margin: 0 0 0.4rem;
    color: var(--text);
    font-size: 0.9rem;
}

.mapleup-store-payment-delivery p {
    margin: 0 0 0.75rem;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.6;
}

.mapleup-store-payment-delivery-copy-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.mapleup-store-payment-delivery pre {
    flex: 1 1 auto;
    margin: 0;
    min-height: 42px;
    padding: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    background: rgba(1, 4, 9, 0.2);
    color: var(--text);
    font-size: 0.76rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.mapleup-store-delivery-copy {
    flex: 0 0 72px;
    width: 72px;
    min-width: 72px;
    min-height: 42px;
    padding: 0 12px;
    align-self: center;
    justify-content: center;
}

#mapleupStoreQrPanel[hidden],
#mapleupStorePaymentTip[hidden],
#mapleupStoreDeliveryBox[hidden],
#mapleupStorePaymentActions[hidden],
#mapleupStoreCancelButton[hidden],
#mapleupStoreQrImage[hidden] {
    display: none !important;
}

.mapleup-store-payment-meta {
    display: grid;
    gap: 0.7rem;
}

.mapleup-store-payment-meta div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-elevated);
}

.mapleup-store-payment-meta span {
    color: var(--text-secondary);
    font-size: 0.74rem;
}

.mapleup-store-payment-meta strong {
    color: var(--text);
    font-size: 0.76rem;
    text-align: right;
    word-break: break-all;
}

.mapleup-store-payment-actions {
    display: flex;
    justify-content: flex-end;
}

.mapleup-store-payment-cancel {
    border-color: rgba(248, 113, 113, 0.35);
    color: #fca5a5;
}

body.mapleup-store-modal-open {
    overflow: hidden;
}

@media (max-width: 960px) {
    .mapleup-store-shell,
    .mapleup-store-modal-body {
        grid-template-columns: 1fr;
    }

    .mapleup-store-product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mapleup-store-hero {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .mapleup-store-form-panel {
        position: static;
    }

    .mapleup-store-payment-qr {
        border-right: 0;
        border-bottom: 1px solid var(--border);
        min-height: 0;
    }
}

@media (max-width: 782px) {
    .mapleup-store-topbar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: 0.6rem;
    }

    .mapleup-store-topbar .gh-commit-info,
    .mapleup-store-topbar-meta {
        width: auto;
        min-width: 0;
    }

    .mapleup-store-topbar .gh-commit-info {
        flex: 1 1 auto;
    }

    .mapleup-store-topbar-meta {
        flex: 0 0 auto;
        flex-wrap: nowrap;
        white-space: nowrap;
    }

    .mapleup-store-topbar .gh-commit-msg,
    .mapleup-store-topbar-meta .gh-file-meta-item {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mapleup-store-hero,
    .mapleup-store-panel {
        padding: 1rem;
    }

    .mapleup-store-product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mapleup-store-product-card {
        min-height: 136px;
        padding: 0.55rem;
    }

    .mapleup-store-modal-overlay {
        padding: 14px;
    }

    .mapleup-store-modal-header,
    .mapleup-store-payment-content {
        padding-left: 18px;
        padding-right: 18px;
    }

    .mapleup-store-payment-delivery-copy-row {
        flex-direction: column;
        align-items: stretch;
    }

    .mapleup-store-delivery-copy {
        width: 100%;
        min-height: 34px;
        flex-basis: auto;
    }
}

@media (max-width: 560px) {
    .mapleup-store-product-grid {
        grid-template-columns: 1fr;
    }
}
