.cart-drawer-layer {
    position: fixed;
    inset: 0;
    z-index: 1200;
    visibility: hidden;
}

.cart-drawer-layer[hidden] {
    display: none;
}

.cart-drawer-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(35, 35, 35, .8);
    opacity: 0;
    cursor: default;
    transition: opacity .5s;
}

.cart-drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    width: min(420px, 100vw);
    height: 100vh;
    height: 100dvh;
    background: #fff;
    color: #232323;
    opacity: 0;
    visibility: hidden;
    transform: translateX(100%);
    transition: opacity .5s, transform .5s, visibility .5s;
}

.cart-drawer-layer.is-open {
    visibility: visible;
}

.cart-drawer-layer.is-open .cart-drawer-overlay {
    opacity: 1;
}

.cart-drawer-layer.is-open .cart-drawer-panel {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

body.cart-drawer-open {
    overflow: hidden;
}

.cart-drawer-close {
    position: absolute;
    top: 21px;
    right: 25px;
    z-index: 2;
    display: grid;
    width: 34px;
    height: 34px;
    padding: 7px;
    border: 0;
    background: transparent;
    color: #232323;
    cursor: pointer;
    place-items: center;
}

.cart-drawer-close svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: currentColor;
    transition: transform .3s;
}

.cart-drawer-close:hover svg {
    transform: rotate(90deg);
}

.cart-drawer-header {
    flex: 0 0 76px;
    padding: 24px 64px 0 30px;
    border-bottom: 1px solid #ececec;
    text-align: left;
}

.cart-drawer-header h2 {
    margin: 0;
    font: 600 20px/24px Roboto, "Noto Sans TC", sans-serif;
    letter-spacing: .02em;
}

.cart-drawer-header p {
    margin: 5px 0 0;
    color: #777;
    font: 400 13px/18px Roboto, "Noto Sans TC", sans-serif;
}

.cart-drawer-content {
    flex: 1 1 auto;
    min-height: 0;
    padding: 12px 30px 24px;
    overflow: hidden auto;
    overscroll-behavior: contain;
}

.cart-drawer-feedback {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid #d9e4d5;
    background: #f4f8f2;
    color: #476f3d;
    font-size: 13px;
    line-height: 19px;
}

.cart-drawer-feedback.is-error {
    border-color: #edc8c5;
    background: #fff4f3;
    color: #b3261e;
}

.cart-drawer-loading {
    display: grid;
    min-height: 220px;
    color: #777;
    place-content: center;
    justify-items: center;
}

.cart-drawer-loading span {
    width: 26px;
    height: 26px;
    border: 2px solid #ddd;
    border-top-color: #263b39;
    border-radius: 50%;
    animation: cart-drawer-spin .8s linear infinite;
}

.cart-drawer-loading p {
    margin: 12px 0 0;
    font-size: 13px;
}

.cart-drawer-empty {
    padding: 56px 0;
    text-align: center;
}

.cart-drawer-empty__eyebrow {
    margin: 0 0 8px;
    color: #78906d;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .18em;
}

.cart-drawer-empty h3 {
    margin: 0;
    font: 600 21px/29px Roboto, "Noto Sans TC", sans-serif;
}

.cart-drawer-empty > p:not(.cart-drawer-empty__eyebrow) {
    margin: 12px auto 22px;
    max-width: 270px;
    color: #777;
    font-size: 14px;
    line-height: 22px;
}

.cart-drawer-empty a {
    display: inline-flex;
    min-width: 170px;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    background: #232323;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}

.cart-drawer-items {
    display: grid;
}

.cart-drawer-item {
    position: relative;
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 15px;
    padding: 0 0 25px;
    margin: 0 0 25px;
    border-bottom: 1px solid #ececec;
    transition: opacity .2s;
}

.cart-drawer-item:last-child {
    margin-bottom: 0;
}

.cart-drawer-item.is-busy {
    opacity: .48;
    pointer-events: none;
}

.cart-drawer-item__image {
    display: block;
    align-self: start;
    background: #f3f3f0;
    overflow: hidden;
}

.cart-drawer-item__image img {
    display: block;
    width: 110px;
    height: auto;
    max-height: 110px;
    object-fit: cover;
}

.cart-drawer-item__placeholder {
    display: grid;
    width: 110px;
    height: 82px;
    color: #8a8a84;
    font-size: 11px;
    place-items: center;
}

.cart-drawer-item__content {
    min-width: 0;
    padding-right: 22px;
}

.cart-drawer-item__title {
    display: inline;
    color: #232323;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    text-decoration: none;
}

.cart-drawer-item__title:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cart-drawer-item__variant {
    margin: 5px 0 8px;
    color: #777;
    font-size: 12px;
    line-height: 18px;
}

.cart-drawer-item__price {
    display: flex;
    gap: 8px;
    align-items: baseline;
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 20px;
}

.cart-drawer-item__price del {
    color: #777;
}

.cart-drawer-item__price strong {
    color: #232323;
    font-weight: 500;
}

.cart-drawer-item__price strong.is-sale {
    color: #e1251b;
}

.cart-drawer-item__controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.cart-drawer-quantity {
    position: relative;
    width: 110px;
    height: 40px;
}

.cart-drawer-quantity input {
    box-sizing: border-box;
    width: 110px;
    height: 40px;
    padding: 8px 30px;
    border: 1px solid #c7c7c7;
    border-radius: 0;
    color: #232323;
    font: 400 14px/20px Roboto, "Noto Sans TC", sans-serif;
    text-align: center;
    appearance: textfield;
}

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

.cart-drawer-quantity button {
    position: absolute;
    top: 0;
    z-index: 1;
    width: 30px;
    height: 40px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #232323;
    font-size: 17px;
    cursor: pointer;
}

.cart-drawer-quantity button:first-child {
    left: 0;
}

.cart-drawer-quantity button:last-child {
    right: 0;
}

.cart-drawer-item__remove {
    padding: 0;
    border: 0;
    background: transparent;
    color: #777;
    font-size: 12px;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.cart-drawer-item__remove-icon {
    position: absolute;
    top: -3px;
    right: 0;
    display: grid;
    width: 24px;
    height: 24px;
    padding: 5px;
    border: 0;
    background: transparent;
    color: #777;
    cursor: pointer;
    place-items: center;
}

.cart-drawer-item__remove-icon svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

.cart-drawer-summary {
    flex: 0 0 auto;
    padding: 18px 30px 24px;
    border-top: 1px solid #e3e3e3;
    background: #fff;
}

.cart-drawer-subtotal {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    font-size: 16px;
    line-height: 22px;
}

.cart-drawer-subtotal strong {
    font-size: 17px;
    font-weight: 600;
}

.cart-drawer-tax-note {
    margin: 7px 0 15px;
    color: #777;
    font-size: 12px;
    line-height: 18px;
}

.cart-drawer-checkout,
.cart-drawer-view-cart {
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.cart-drawer-checkout {
    border: 1px solid #232323;
    background: #232323;
    color: #fff;
    transition: color .3s, background-color .3s, opacity .3s;
}

.cart-drawer-checkout:hover {
    background: #fff;
    color: #232323;
}

.cart-drawer-view-cart {
    min-height: 38px;
    color: #232323;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 4px;
}

@keyframes cart-drawer-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
    .cart-drawer-header {
        padding-left: 20px;
    }

    .cart-drawer-content {
        padding-right: 20px;
        padding-left: 20px;
    }

    .cart-drawer-summary {
        padding-right: 20px;
        padding-left: 20px;
    }

    .cart-drawer-item {
        grid-template-columns: 92px minmax(0, 1fr);
        gap: 12px;
    }

    .cart-drawer-item__image img,
    .cart-drawer-item__placeholder {
        width: 92px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cart-drawer-overlay,
    .cart-drawer-panel,
    .cart-drawer-close svg {
        transition-duration: .01ms;
    }

    .cart-drawer-loading span {
        animation: none;
    }
}

/* Hidden drawer states must override component display modes. */
.cart-drawer-loading[hidden],
.cart-drawer-empty[hidden],
.cart-drawer-items[hidden],
.cart-drawer-summary[hidden],
.cart-drawer-feedback[hidden] {
    display: none !important;
}
