:root {
    --cart-overlay-bg: #0d1b2a;
    --cart-overlay-surface: #16283a;
    --cart-overlay-border: rgba(184, 196, 209, .22);
    --cart-overlay-text: #ffffff;
    --cart-overlay-muted: #9eabb8;
    --cart-overlay-green: #00d77a;
}

.cart-overlay-fab {
    position: fixed;
    z-index: 880;
    top: 62%;
    right: 16px;
    bottom: auto;
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(0, 215, 122, .7);
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(29, 70, 57, .96), rgba(13, 37, 33, .98));
    box-shadow: 0 14px 30px rgba(0, 0, 0, .34), inset 0 1px rgba(255, 255, 255, .08);
    color: var(--cart-overlay-green);
    cursor: pointer;
    isolation: isolate;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    transform: translateY(-50%);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.cart-overlay-fab.is-mobile-positioned { transform: none !important; }
.cart-overlay-fab.is-dragging { cursor: grabbing; opacity: .88; box-shadow: 0 18px 38px rgba(0, 0, 0, .45), 0 0 0 6px rgba(0, 215, 122, .13); }
.cart-overlay-fab.is-dragging, .cart-overlay-fab.is-dragging * { pointer-events: none; }
.cart-overlay-fab svg { width: 25px; height: 25px; }
.cart-overlay-fab-label { display: none; }
.cart-overlay-fab-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    display: grid;
    min-width: 19px;
    height: 19px;
    place-items: center;
    padding: 0 4px;
    border: 2px solid var(--cart-overlay-bg);
    border-radius: 999px;
    background: #ff5b5b;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
}
.cart-overlay-fab-badge[hidden] { display: none; }
.cart-overlay-fab:hover { border-color: var(--cart-overlay-green); box-shadow: 0 18px 36px rgba(0, 0, 0, .42), 0 0 0 5px rgba(0, 215, 122, .09); transform: translateY(-2px); }
.cart-overlay-fab:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.cart-overlay-fab.is-bumping { animation: cart-overlay-bump .36s ease; }

@media (max-width: 959px) {
    body.seo-product-page .cart-overlay-fab,
    html.tg-mini-app body.seo-product-page .cart-overlay-fab {
        top: 62%;
        bottom: auto;
    }
}
html.tg-mini-app body.seo-category-page .cart-overlay-fab,
html.tg-mini-app body.seo-knowledge-page .cart-overlay-fab {
    top: 62%;
    bottom: auto;
}

.cart-overlay-modal {
    position: fixed;
    z-index: 10050;
    inset: 0;
    display: grid;
    align-items: end;
    background: rgba(2, 11, 20, .55);
    backdrop-filter: blur(5px);
}
.cart-overlay-modal[hidden] { display: none; }
.cart-overlay-panel {
    display: flex;
    width: 100%;
    max-height: min(78dvh, 680px);
    min-height: 290px;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--cart-overlay-border);
    border-bottom: 0;
    border-radius: 24px 24px 0 0;
    background: var(--cart-overlay-surface);
    box-shadow: 0 -20px 52px rgba(0, 0, 0, .38);
    color: var(--cart-overlay-text);
}
.cart-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px 14px;
    border-bottom: 1px solid var(--cart-overlay-border);
}
.cart-overlay-header p { margin: 0 0 3px; color: var(--cart-overlay-green); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.cart-overlay-header h2 { margin: 0; font-size: 21px; line-height: 1.2; }
.cart-overlay-close {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--cart-overlay-border);
    border-radius: 12px;
    background: rgba(13, 27, 42, .66);
    color: var(--cart-overlay-text);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}
.cart-overlay-list { min-height: 0; flex: 1; overflow: auto; padding: 8px 14px; overscroll-behavior: contain; }
.cart-overlay-empty { min-height: 180px; flex: 1; align-items: center; justify-content: center; gap: 10px; flex-direction: column; color: var(--cart-overlay-muted); }
.cart-overlay-empty:not([hidden]) { display: flex; }
.cart-overlay-empty svg { width: 42px; height: 42px; color: var(--cart-overlay-green); }
.cart-overlay-footer { flex: 0 0 auto; padding: 14px 16px calc(14px + var(--safe-area-bottom, 0px)); border-top: 1px solid var(--cart-overlay-border); background: rgba(8, 21, 34, .74); }
.cart-overlay-summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.cart-overlay-summary > div { display: grid; gap: 2px; text-align: right; }
.cart-overlay-summary > div span { color: var(--cart-overlay-muted); font-size: 12px; }
.cart-overlay-summary strong { color: var(--cart-overlay-green); font-size: 20px; }
.cart-overlay-select-all { display: inline-flex; align-items: center; gap: 8px; color: var(--cart-overlay-text); cursor: pointer; }
.cart-overlay-select-all input { width: 18px; height: 18px; accent-color: var(--cart-overlay-green); }
.cart-overlay-checkout { width: 100%; min-height: 48px; border: 0; border-radius: 13px; background: var(--cart-overlay-green); color: #072218; font: inherit; font-weight: 900; cursor: pointer; }
.cart-overlay-checkout:disabled { opacity: .45; cursor: not-allowed; }

.cart-overlay-list .cart-item { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 0; overflow: visible; border: 0; border-bottom: 1px solid rgba(184, 196, 209, .12); border-radius: 0; background: transparent; position: static; max-width: none; }
.cart-overlay-list .cart-item-left { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; margin: 0; }
.cart-overlay-list .cart-item-checkbox { width: 17px; height: 17px; margin: 0; accent-color: var(--cart-overlay-green); flex: 0 0 auto; }
.cart-overlay-list .cart-item-image { width: 58px; height: 58px; flex: 0 0 58px; border: 1px solid var(--cart-overlay-border); border-radius: 10px; background: #0d1b2a; object-fit: cover; }
.cart-overlay-list .cart-item-right { display: flex; min-width: 0; flex: 1; flex-direction: column; justify-content: center; padding: 0; overflow: visible; }
.cart-overlay-list .cart-item-name { overflow: hidden; margin: 0; color: var(--cart-overlay-text); font-size: 14px; font-weight: 750; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; word-break: normal; }
.cart-overlay-list .cart-item-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.cart-overlay-list .cart-item-price { color: var(--cart-overlay-green); font-size: 14px; font-weight: 800; }
.cart-overlay-list .cart-item-controls { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.cart-overlay-list .cart-item-btn, .cart-overlay-list .cart-item-delete { position: static; display: grid; width: 26px; min-width: 26px; height: 26px; min-height: 26px; place-items: center; padding: 0; border: 1px solid var(--cart-overlay-border); border-radius: 7px; background: rgba(13, 27, 42, .7); color: var(--cart-overlay-text); cursor: pointer; font-size: 15px; line-height: 1; }
.cart-overlay-list .cart-item-delete { margin-left: 2px; border-color: transparent; background: transparent; color: #ff8a8a; }
.cart-overlay-list .cart-item-qty { width: 30px; height: 26px; margin: 0; padding: 3px 1px; border: 0; border-radius: 0; background: transparent; color: var(--cart-overlay-text); font: inherit; text-align: center; }
.cart-overlay-list .cart-item-qty::-webkit-inner-spin-button, .cart-overlay-list .cart-item-qty::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }

.cart-overlay-fly-token {
    position: fixed;
    z-index: 10100;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, .9);
    border-radius: 50%;
    background: var(--cart-overlay-green);
    box-shadow: 0 0 0 6px rgba(0, 215, 122, .16);
    pointer-events: none;
    transform: translate3d(0, 0, 0) scale(1);
    transition: transform .52s cubic-bezier(.2, .78, .22, 1), opacity .52s ease;
}
.cart-overlay-fly-token.is-flying { opacity: .2; transform: translate3d(var(--cart-fly-x), var(--cart-fly-y), 0) scale(.25); }
@keyframes cart-overlay-bump { 0%, 100% { transform: scale(1); } 35% { transform: scale(1.16) rotate(-4deg); } 65% { transform: scale(.94) rotate(3deg); } }
@keyframes cart-overlay-desktop-bump { 0%, 100% { transform: translateY(-50%) scale(1); } 35% { transform: translateY(-50%) scale(1.12) rotate(-3deg); } 65% { transform: translateY(-50%) scale(.96) rotate(2deg); } }

@media (min-width: 960px) {
    .cart-overlay-fab,
    body.seo-product-page .cart-overlay-fab,
    html.tg-mini-app body.seo-product-page .cart-overlay-fab,
    html.tg-mini-app body.seo-category-page .cart-overlay-fab,
    html.tg-mini-app body.seo-knowledge-page .cart-overlay-fab {
        top: 50%;
        right: 0;
        bottom: auto;
        display: inline-flex;
        width: 58px;
        min-width: 0;
        height: 66px;
        justify-content: center;
        gap: 0;
        padding: 0;
        overflow: hidden;
        border-radius: 18px 0 0 18px;
        transform: translateY(-50%);
        transition: width .22s ease, transform .2s ease, border-color .2s ease, box-shadow .2s ease;
    }
    .cart-overlay-fab-label { display: inline; max-width: 0; overflow: hidden; opacity: 0; transform: translateX(8px); transition: max-width .2s ease, opacity .16s ease, transform .2s ease; white-space: nowrap; font-size: 14px; font-weight: 850; }
    .cart-overlay-fab:hover, .cart-overlay-fab:focus-visible { width: 146px; justify-content: flex-start; gap: 9px; padding: 0 18px; transform: translateY(-50%); }
    .cart-overlay-fab:hover .cart-overlay-fab-label, .cart-overlay-fab:focus-visible .cart-overlay-fab-label { max-width: 70px; opacity: 1; transform: translateX(0); }
    .cart-overlay-fab-badge { top: 6px; right: 7px; }
    .cart-overlay-fab.is-bumping { animation-name: cart-overlay-desktop-bump; }
    .cart-overlay-modal { justify-items: end; align-items: center; padding-right: 0; background: rgba(2, 11, 20, .2); backdrop-filter: none; }
    .cart-overlay-panel { width: min(420px, calc(100vw - 56px)); max-height: min(760px, calc(100dvh - 72px)); border: 1px solid var(--cart-overlay-border); border-radius: 20px; box-shadow: 0 24px 60px rgba(0, 0, 0, .44); }
    .cart-overlay-footer { padding-bottom: 16px; }
}

@media (max-width: 374px) {
    .cart-overlay-fab { right: 12px; width: 50px; height: 50px; border-radius: 50%; }
}

@media (prefers-reduced-motion: reduce) {
    .cart-overlay-fab, .cart-overlay-fly-token { transition: none; animation: none; }
}
