.cart-drawer {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100%;
    display: flex;
    justify-content: flex-end;
    background-color: rgba(var(--color-mask), 0.5);
    transition: visibility 200ms ease;
}

.cart-drawer {
    visibility: hidden;
}

.cart-drawer.active {
    visibility: visible;
}

.cart-drawer__inner {
    height: 100%;
    overflow: hidden;
    transform: translateX(100%);
    transition: transform 200ms ease;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background-color: rgb(var(--color-page-background));
}

.cart-drawer__fixed-checkout {
    transform: translateX(100%);
    transition: transform 200ms ease;
}

.cart-drawer__inner .cart-drawer__inner-wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.cart-drawer__warnings {
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: center;
}

.cart-drawer.active .cart-drawer__inner,
.cart-drawer.active .cart-drawer__fixed-checkout {
    transform: translateX(0);
}

.cart-drawer__header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
}

.cart-drawer__header::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: -20px;
    width: calc(100% + 40px);
    height: 1px;
    background-color: rgb(var(--color-entry-line));
}

.cart-drawer__close {
    color: rgb(var(--color-text));
    cursor: pointer;
    width: 24px;
    height: 24px;
    line-height: 0;
    top: 2px;
    right: -4px;
    padding: 6px;
    position: absolute;
}

cart-drawer {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100%;
}

.cart-drawer-container {
    width: 440px;
}

.cart-drawer__overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.cart-drawer__overlay:empty {
    display: block;
}

/* cart-drawer-items {
  overflow: auto;
  flex: 1;
} */

.cart-drawer__inner {
    overflow-y: scroll;
}

@media screen and (max-height: 650px) {
    cart-drawer-items {
        overflow: visible;
    }

    .cart-drawer__inner {
        overflow-y: scroll;
    }
}

@media (max-width: 959px) {
    .cart-drawer-container {
        width: 90%;
    }
}

cart-drawer-items::-webkit-scrollbar {
    width: 3px;
}

cart-drawer-items::-webkit-scrollbar-thumb {
    background-color: rgba(18, 18, 18, 0.7);
    border-radius: 100px;
}

cart-drawer-items::-webkit-scrollbar-track-piece {
    margin-top: 20px;
}

/* cart-drawer-footer */

.cart-drawer__footer__container {
    display: flex;
    justify-content: flex-end;
    padding-top: 40px;
    padding-bottom: 40px;
}

.cart-drawer__checkout-container {
    width: 100%;
    position: relative;
    padding: 40px 0;
}

.cart-drawer__checkout-container::after {
    content: "";
    position: absolute;
    top: 0;
    left: -20px;
    width: calc(100% + 40px);
    height: 1px;
    background-color: rgb(var(--color-entry-line));
}

.cart-drawer__amount-wrapper {
    margin: 0;
    padding: 0;
}

.cart-drawer__amount-wrapper li {
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: rgb(var(--color-text));
    margin-bottom: 8px;
}

.cart-drawer__amount-wrapper li em {
    font-style: normal;
    margin-right: 12px;
}

.cart-drawer__amount-wrapper .cart__discount span {
    color: rgb(var(--color-discount));
}

.cart-drawer__discount span {
    color: rgb(var(--color-discount));
}

#checkout {
    width: 100%;
}

.cart-drawer__checkout {
    margin-top: 15px;
}

.cart-drawer__taxes__desc {
    text-align: center;
}

.cart-drawer__body {
    position: relative;
    display: flex;
    height: 100%;
    flex-direction: column;
}

.cart-drawer__body .cart-drawer__inner {
    flex: 1;
}

.cart-drawer__body .cart-fixed-checkout {
    position: static;
}

/* The ipad end responds to the mobile end in vertical screen */

/* @custom-media --tablet (max-width: 959px); */

/* @custom-media --gt-mobile (min-width: 751px); */

/* detectingScreen need to consider the configuration of the tablet */


/* Otakuplan 2026-10-05: keep the drawer focused on the selected items and checkout. */
#cart-drawer .j-shopline-CountdownOfCart,
#cart-drawer .cart-sku-list-promotion-module,
#cart-drawer .product-recommend-plugin-wrapper {
    display: none !important;
}

#cart-drawer .cart-drawer__checkout-container {
    padding: 20px 0;
}

#cart-drawer .op-cart-shipping {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.4;
}

#cart-drawer .op-cart-shipping strong {
    color: #24573d;
}

#cart-drawer .op-cart-shipping a,
#cart-drawer .op-cart-support a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

#cart-drawer .op-cart-support {
    margin-top: 8px;
    text-align: center;
    font-size: 12px;
    line-height: 1.4;
}

/* Otakuplan 2026-10-05: automatic offer tiers and a clear shipping benefit. */
#cart-drawer .op-cart-offer {
    margin: 0 0 18px;
    padding: 14px;
    border: 1px solid #e7dcc6;
    border-radius: 12px;
    background: #fcf8ef;
    color: #24211c;
}

#cart-drawer .op-cart-offer h3 {
    margin: 0;
    font-size: 16px;
    line-height: 1.3;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

#cart-drawer .op-cart-offer__tiers {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 11px 0;
}

#cart-drawer .op-cart-offer__tiers>div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    padding: 9px 8px;
    border: 1px solid #e9dfcd;
    border-radius: 7px;
    background: #fff;
}

#cart-drawer .op-cart-offer__tiers span {
    font-size: 12px;
    line-height: 1.3;
    white-space: nowrap;
}

#cart-drawer .op-cart-offer__tiers strong {
    font-size: 14px;
    line-height: 1.3;
    white-space: nowrap;
}

#cart-drawer .op-cart-offer p {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
    color: #355340;
}

#cart-drawer .op-cart-offer p svg {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
}

#cart-drawer .op-cart-shipping {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    margin: 0 12px 8px;
    padding: 10px 12px;
    border: 1px solid #cfe4d6;
    border-radius: 10px;
    background: #edf7f0;
    color: #24573d;
    line-height: 1.35;
}

#cart-drawer .op-cart-shipping>svg {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
}

#cart-drawer .op-cart-shipping strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
}

#cart-drawer .op-cart-shipping span {
    display: block;
    margin-top: 2px;
    font-size: 12px;
}

#cart-drawer .op-cart-support {
    margin: 6px 12px 10px;
    font-size: 12px;
    line-height: 1.45;
    color: #484848;
}

@media (max-width: 959px) and (max-height: 700px) {
    #cart-drawer .cart-drawer__checkout-container {
        padding: 16px 0;
    }

    #cart-drawer .op-cart-offer {
        padding: 10px;
        margin-bottom: 14px;
    }

    #cart-drawer .op-cart-offer h3 {
        font-size: 14px;
    }

    #cart-drawer .op-cart-offer__tiers {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 5px;
        margin: 8px 0;
    }

    #cart-drawer .op-cart-offer__tiers>div {
        flex-direction: column;
        gap: 3px;
        padding: 6px 2px;
    }

    #cart-drawer .op-cart-offer__tiers span {
        font-size: 11px;
    }

    #cart-drawer .op-cart-offer__tiers strong {
        font-size: 12px;
    }

    #cart-drawer .op-cart-offer p {
        font-size: 11px;
        line-height: 1.3;
    }
}

/* Otakuplan 2026-10-06: drawer-only compact layout.
   Append after section-cart-drawer.css. Requires the compact offer in the
   drawer fixed-checkout snippet. Native totals, responsive price branches,
   checkout forms, variant text and error text remain in the DOM. */

/* Keep the native open/close transforms; only the item list scrolls. */
#cart-drawer .cart-drawer-container {
    height: 100%;
    max-height: 100dvh;
    overflow: hidden;
}

#cart-drawer .cart-drawer__body {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

#cart-drawer .cart-drawer__body .cart-drawer__inner {
    flex: 1 1 0;
    height: auto;
    min-height: 0;
    padding: 0 12px;
    overflow: hidden;
}

#cart-drawer .cart-drawer__inner .cart-drawer__inner-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

#cart-drawer .cart-drawer__header {
    box-sizing: border-box;
    flex: 0 0 50px;
    height: 50px;
    min-height: 50px;
    padding: 0 36px 0 0;
}

#cart-drawer .cart-drawer__heading {
    margin: 0;
    font-size: 16px;
    line-height: 20px;
}

#cart-drawer .cart-drawer__header::after {
    left: -12px;
    width: calc(100% + 24px);
}

#cart-drawer .cart-drawer__close {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    top: 9px;
    right: 0;
    width: 32px;
    height: 32px;
    padding: 4px;
}

#cart-drawer cart-drawer-items {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}

#cart-drawer .cart-drawer__items {
    margin: 0;
    padding: 0;
}

/* The fixed footer has the same native totals and checkout form. Keep the
   empty-cart branch untouched; hide the nonempty body's duplicate display. */
#cart-drawer .cart-drawer__inner-wrapper:not(.cart-empty) .cart-drawer__checkout-container {
    display: none;
}

#cart-drawer #CartDrawer-CartErrors:empty {
    display: none;
}

#cart-drawer .cart-drawer__fixed-checkout {
    position: static;
    flex: 0 0 auto;
    min-height: 0;
}

/* A normal two-line title + Style + Size is about 118px including padding.
   Fleece/other custom properties and real errors may expand without clipping. */
#cart-drawer .cart-item {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    margin: 0;
    padding: 8px 0;
    height: auto;
    min-height: 0;
    max-height: none;
}

#cart-drawer .cart-item__media,
#cart-drawer .cart-item__image-container {
    box-sizing: border-box;
    display: block;
    flex: none;
    width: 64px;
    min-width: 64px;
    max-width: 64px;
    height: 64px;
    margin: 0;
    padding: 0;
}

#cart-drawer .cart-item__image-container img {
    display: block;
    width: 64px;
    height: 64px;
    max-width: 100%;
    max-height: 64px;
    object-fit: contain;
    object-position: center;
}

#cart-drawer .cart-item__details__wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "details details""price quantity";
    align-items: center;
    gap: 4px 6px;
    width: auto;
    min-width: 0;
    height: auto;
    min-height: 0;
    max-height: none;
    margin: 0;
    padding: 0;
}

#cart-drawer .cart-item__details {
    grid-area: details;
    display: block;
    width: auto;
    min-width: 0;
    max-width: none;
    height: auto;
    max-height: none;
    margin: 0;
    padding: 0;
}

#cart-drawer .cart-item__name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    width: auto;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 0;
    font-size: 13px;
    line-height: 16px;
    white-space: normal;
    overflow-wrap: anywhere;
}

#cart-drawer .cart-item__details .product-option,
#cart-drawer .cart-item__details .product-property {
    display: block;
    width: auto;
    min-width: 0;
    max-width: none;
    height: auto;
    max-height: none;
    margin: 0;
    padding: 0;
    font-size: 12px;
    line-height: 15px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
}

#cart-drawer .cart-item__details .product-option>span,
#cart-drawer .cart-item__details .product-property>span,
#cart-drawer .cart-item__details .product-property__name {
    display: inline;
    flex: initial;
    width: auto;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
}

/* Grid placement is shared; display is still explicitly mutually exclusive
   at the native desktop/tablet breakpoint. Never show both YMQ line prices. */
#cart-drawer .cart-item__totals {
    grid-area: price;
    justify-self: start;
    align-self: center;
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    text-align: left;
}

#cart-drawer .cart-item__price-wrapper,
#cart-drawer .cart-item__price-wrapper .final__price {
    margin: 0;
    padding: 0;
    font-size: 13px;
    line-height: 18px;
}

#cart-drawer .cart-item__quantity {
    grid-area: quantity;
    justify-self: end;
    width: 148px;
    min-width: 0;
    height: auto;
    min-height: 0;
    max-height: none;
    margin: 0;
    padding: 0;
}

#cart-drawer .cart-item__quantity>div {
    height: auto;
    min-height: 0;
    max-height: none;
    margin: 0;
    padding: 0;
}

#cart-drawer .cart-item__quantity-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 36px;
    margin: 0;
    padding: 0;
}

#cart-drawer .cart-item__quantity .quantity {
    box-sizing: border-box;
    display: flex;
    flex: 0 0 108px;
    width: 108px;
    min-width: 108px;
    height: 36px;
    min-height: 36px;
    margin: 0;
    padding: 0;
}

#cart-drawer .cart-item__quantity .quantity__button,
#cart-drawer .cart-item__quantity .quantity__input {
    box-sizing: border-box;
    flex: 0 0 36px;
    width: 36px;
    min-width: 0;
    height: 36px;
    min-height: 36px;
    margin: 0;
    padding: 0;
}

#cart-drawer .cart-item__quantity .quantity__input {
    font-size: 12px;
    line-height: 36px;
    text-align: center;
}

#cart-drawer .cart-item__quantity cart-remove-button {
    box-sizing: border-box;
    display: flex;
    flex: 0 0 36px;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
}

/* The error container always has an SVG, so inspect the text child rather
   than :empty on the container. Nonempty messages remain fully readable. */
#cart-drawer .cart-item__error {
    height: auto;
    min-height: 0;
    max-height: none;
    margin: 4px 0 0;
    overflow: visible;
}

#cart-drawer .cart-item__error:has(.cart-item__error-text:empty) {
    display: none;
}

#cart-drawer .cart-item__error:has(.cart-item__error-text:not(:empty)) {
    display: flex;
    align-items: start;
    gap: 4px;
}

#cart-drawer .cart-item__error-text {
    min-width: 0;
    font-size: 12px;
    line-height: 15px;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* Compact fixed footer: four tiers ~58px, shipping <=37px, native total /
   Checkout ~44px, and the short support copy can occupy one or two lines.
   Do not set a hard height: expanded native discounts and accessibility text
   must remain readable. */
#cart-drawer .cart-drawer__fixed-checkout .cart-fixed-checkout__container {
    box-sizing: border-box;
    padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px));
    min-height: 0;
}

#cart-drawer .cart-drawer__fixed-checkout .cart-fixed-checkout__wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    height: auto;
    margin: 0;
    padding: 0;
}

#cart-drawer .op-cart-offer.op-cart-offer--compact {
    box-sizing: border-box;
    margin: 0;
    padding: 6px 8px;
    border-radius: 8px;
}

#cart-drawer .op-cart-offer--compact h3 {
    display: none;
}

#cart-drawer .op-cart-offer--compact .op-cart-offer__tiers {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    margin: 0 0 3px;
}

#cart-drawer .op-cart-offer--compact .op-cart-offer__tiers>div {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

#cart-drawer .op-cart-offer--compact .op-cart-offer__tiers span {
    font-size: 11px;
    line-height: 13px;
    white-space: nowrap;
}

#cart-drawer .op-cart-offer--compact .op-cart-offer__tiers strong {
    font-size: 12px;
    line-height: 15px;
    white-space: nowrap;
}

#cart-drawer .op-cart-offer--compact p {
    justify-content: center;
    gap: 4px;
    margin: 0;
    font-size: 11px;
    line-height: 14px;
}

#cart-drawer .op-cart-offer--compact p svg {
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
}

#cart-drawer .op-cart-shipping {
    box-sizing: border-box;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 4px 8px;
    border-radius: 8px;
}

#cart-drawer .op-cart-shipping>svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

#cart-drawer .op-cart-shipping>div {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 6px;
    min-width: 0;
}

#cart-drawer .op-cart-shipping strong {
    display: inline;
    font-size: 12px;
    line-height: 14px;
}

#cart-drawer .op-cart-shipping span {
    display: inline;
    margin: 0;
    font-size: 11px;
    line-height: 13px;
}

#cart-drawer .cart-drawer__fixed-checkout .cart-fixed-checkout__footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(140px, 1.15fr);
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
}

#cart-drawer .cart-drawer__fixed-checkout .cart__total {
    min-width: 0;
    margin: 0;
    padding: 0;
}

#cart-drawer .cart-drawer__fixed-checkout .cart__total-text,
#cart-drawer .cart-drawer__fixed-checkout .cart__saved-price,
#cart-drawer .cart-drawer__fixed-checkout .cart__saved-price .body3 {
    font-size: 11px;
    line-height: 13px;
    margin: 0;
}

#cart-drawer .cart-drawer__fixed-checkout .cart__total-price,
#cart-drawer .cart-drawer__fixed-checkout .cart__total-price .body2 {
    font-size: 14px;
    line-height: 18px;
    margin: 0;
}

#cart-drawer .cart-drawer__fixed-checkout .cart-fixed-checkout__buttons,
#cart-drawer .cart-drawer__fixed-checkout .cart-fixed-checkout__buttons form {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
}

#cart-drawer .cart-drawer__fixed-checkout .cart-drawer__checkout-button,
#cart-drawer .cart-drawer__fixed-checkout .cart-fixed-checkout__buttons form>.ymq_c_btn {
    box-sizing: border-box;
    width: 100%;
    height: 44px;
    min-height: 44px;
    margin: 0;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 20px;
}

#cart-drawer .op-cart-support {
    margin: 0;
    padding: 0;
    font-size: 11px;
    line-height: 14px;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
}

@media (max-width: 959px) {
    #cart-drawer .cart-item__totals.display-none-desktop {
        display: block !important;
    }

    #cart-drawer .cart-item__totals.display-none-tablet {
        display: none !important;
    }
}

@media (min-width: 960px) {
    #cart-drawer .cart-item__totals.display-none-desktop {
        display: none !important;
    }

    #cart-drawer .cart-item__totals.display-none-tablet {
        display: block !important;
    }
}

@media (max-width: 359px) {
    #cart-drawer .cart-drawer-container {
        width: 100%;
    }
}