.export {
    position: relative;
    width: 100%;
    container-type: inline-size;
}

.export>.frame {
    width: 100%;
    max-width: var(--w-frame);
    min-height: 210px;
    /* 上 112 + 下 90，依框寬等比換算，避免上下段重疊把框壓扁 */
    min-height: calc(min(100cqw, var(--w-frame)) * 202 / 1164);
    padding: 24px 32px 30px;
    background: url(../images/frame/fmm_01.jpg) center top / 100% auto no-repeat, url(../images/frame/fmm_03.jpg) center bottom / 100% auto no-repeat, url(../images/frame/fmm_02.jpg) center top / 100% auto repeat-y;
}

.export-panel {
    width: 100%;
    color: #e9dfc8;
}

.export-head {
    margin-bottom: 22px;
    text-align: center;
}

.export-title {
    font-family: var(--f-serif);
    font-size: 28px;
    font-weight: 900;
    color: #1c2a4a;
    letter-spacing: .15em;
    padding-top: 20px;
}

.export-subtitle {
    margin-top: 6px;
    color: #48443b;
    font-size: 16px;
    line-height: 1.6;
}

.export-box {
    width: 80%;
    margin: 0 auto;
}

.export-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.export-card {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 129px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 4px;
    border: 1px solid #5c472c;
    border-radius: 11px;
    background: linear-gradient(145deg, rgba(255, 240, 211, .035), rgba(255, 240, 211, .015));
    color: #eee5d2;
    text-align: center;
    cursor: pointer;
    transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.export-card:hover,
.export-card:focus-visible {
    transform: translateY(-2px);
    border-color: #a17a43;
    background: rgba(243, 207, 122, .08);
    box-shadow: 0 5px 16px rgba(0, 0, 0, .2);
    outline: none;
}

.export-card.is-selected {
    border-color: #c0924d;
    background: rgba(243, 207, 122, .12);
    box-shadow: inset 0 0 0 1px rgba(243, 207, 122, .18);
}

.export-card::before,
.export-card::after {
    position: absolute;
    width: 14px;
    height: 14px;
    content: "";
    pointer-events: none;
}

.export-card::before {
    top: 7px;
    left: 7px;
    background: linear-gradient(#d8c9a8, #d8c9a8) left top/13px 1px no-repeat,
        linear-gradient(#d8c9a8, #d8c9a8) left top/1px 13px no-repeat;
}

.export-card::after {
    right: 7px;
    bottom: 7px;
    background: linear-gradient(#d8c9a8, #d8c9a8) right bottom/13px 1px no-repeat,
        linear-gradient(#d8c9a8, #d8c9a8) right bottom/1px 13px no-repeat;
}

.export-panel .export-card img {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.export-card__label {
    color: #81776b;
    font-family: var(--f-sans);
    font-size: 16px;
    line-height: 1.4;
}

.export-card__quantity {
    color: #302a21;
    font-family: var(--f-sans);
    font-size: 16px;
    line-height: 1.4;
}

/* 已選購買數量：右上角圓形徽章 */
.export-card__badge {
    position: absolute;
    top: -9px;
    right: -9px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 7px;
    border: 2px solid #f3cf7a;
    border-radius: 999px;
    background: #c8261f;
    color: #fff;
    font-family: var(--f-sans);
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
    pointer-events: none;
    animation: export-pop-in .18s ease;
}

.export-card__badge[hidden] {
    display: none;
}

.export-card.is-used {
    border-color: #51483c;
    background: rgba(255, 255, 255, .035);
    color: #81776b;
    cursor: not-allowed;
}

.export-card.is-used img {
    filter: grayscale(1) brightness(.82);
    opacity: .58;
}

.export-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 22px;
    padding: 20px;
    border-top: 1px solid #554228;
}

.export-summary {
    min-width: 0;
    color: #3e372b;
    font-size: 16px;
    line-height: 1.7;
}

.export-summary strong {
    color: #ff1919;
}

.export-reward-count {
    color: #d34a36 !important;
}

.export-actions {
    display: flex;
    flex: none;
    gap: 10px;
}

.export-hex {
    width: 150px;
}

.export-hex img {
    width: 100%;
}

.export-hex:disabled {
    cursor: not-allowed;
    filter: grayscale(1);
    opacity: .55;
}

.export-backdrop:not([hidden]) {
    position: fixed;
    z-index: 79;
    inset: 0;
    background: transparent;
}

.export-pop:not([hidden]) {
    position: absolute;
    z-index: 80;
    width: min(280px, calc(100vw - 32px));
    padding: 14px;
    border: 1px solid #765a32;
    border-radius: 12px;
    background: #1f2638;
    color: #f1e6cf;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
    animation: export-pop-in .16s ease-out;
}

.export-stepper,
.export-quick {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.export-stepper input {
    appearance: textfield;
    width: 76px;
    padding: 5px;
    border: 1px solid #8d734b;
    border-radius: 3px;
    background: #fff6d8;
    color: #2a1a0a;
    text-align: center;
}

.export-stepper input::-webkit-inner-spin-button,
.export-stepper input::-webkit-outer-spin-button {
    margin: 0;
    appearance: none;
}

.export-circle,
.export-quick button {
    min-width: 36px;
    min-height: 36px;
    padding: 4px 10px;
    border: 1px solid #8d734b;
    border-radius: 8px;
    color: #f3cf7a;
}

.export-circle {
    display: grid;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    place-items: center;
    padding: 0;
    line-height: 1;
}

.export-circle:hover,
.export-quick button:hover {
    background: rgba(243, 207, 122, .16);
}

.export-quick {
    margin-top: 12px;
}

.export-hint {
    margin-top: 10px;
    color: #c9bea7;
    font-size: 12px;
    text-align: center;
}

.export-pop-foot {
    margin-top: 12px;
    text-align: center;
}

.export-confirm {
    padding: 5px 20px;
    border: 1px solid #d9b66b;
    border-radius: 3px;
    background: #6d3a1d;
    color: #fff2cf;
}

.export-confirm:hover {
    background: #8a4b24;
}

.export-confirm:disabled {
    cursor: not-allowed;
    opacity: .5;
}

.export-modal:not([hidden]) {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, .72);
}

.export-modal-card {
    width: min(420px, 100%);
    padding: 24px;
    border: 1px solid #b8955a;
    border-radius: 6px;
    background: #171b28;
    color: #f1e6cf;
    text-align: center;
}

.export-modal-title {
    margin-bottom: 10px;
    color: #f3cf7a;
    font-family: var(--f-serif);
    font-size: 22px;
}

.export-modal-text {
    margin-bottom: 16px;
}

@keyframes export-pop-in {
    from {
        opacity: 0;
        transform: translateY(6px) scale(.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 900px) {
    .export>.frame {
        padding: 28px 40px 36px;
    }

    .export-box {
        width: 100%;
    }

    .export-hex {
        width: 110px;
    }
}

@media (max-width: 600px) {
    .export>.frame {
        padding: 24px 16px 30px;
    }

    .export-title {
        font-size: 20px;
    }

    .export-subtitle {
        font-size: 12px;
    }

    .export-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .export-card {
        min-height: 105px;
    }

    .export-panel .export-card img {
        width: 52px;
        height: 52px;
    }

    .export-footer {
        align-items: flex-start;
        flex-direction: column;
        padding: 16px 0;
    }

    .export-summary {
        font-size: 14px;
    }

    .export-actions {
        align-self: flex-end;
    }

    .export-hex {
        width: min(38vw, 150px);
    }
}