:root {
    --bg: var(--tg-theme-bg-color, #ffffff);
    --secondary-bg: var(--tg-theme-secondary-bg-color, #f3f4f6);
    --text: var(--tg-theme-text-color, #111111);
    --hint: var(--tg-theme-hint-color, #777777);
    --button: var(--tg-theme-button-color, #2481cc);
    --button-text: var(--tg-theme-button-text-color, #ffffff);
    --section: var(--tg-theme-section-bg-color, #ffffff);

    --radius: 16px;
}


* {
    box-sizing: border-box;
}


html,
body {
    margin: 0;
    padding: 0;

    width: 100%;
    min-height: 100%;

    background: var(--bg);
    color: var(--text);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
}


body {
    padding-bottom: 90px;
}


button,
input {
    font: inherit;
}


button {
    border: 0;
    cursor: pointer;
}


#app {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}


.header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 18px 16px 12px;
}


.logo {
    font-size: 25px;
    font-weight: 800;
    letter-spacing: 1px;
}


.subtitle {
    margin-top: 2px;
    color: var(--hint);
    font-size: 13px;
}


.icon-button {
    width: 42px;
    height: 42px;

    border-radius: 50%;

    background: var(--secondary-bg);
    color: var(--text);

    font-size: 25px;
}


.search-box {
    display: flex;
    align-items: center;
    gap: 9px;

    margin: 8px 16px 16px;
    padding: 0 14px;

    height: 48px;

    border-radius: 14px;

    background: var(--secondary-bg);
}


.search-box span {
    font-size: 18px;
}


.search-box input {
    flex: 1;

    min-width: 0;

    border: 0;
    outline: 0;

    background: transparent;
    color: var(--text);

    font-size: 16px;
}


.products {
    display: flex;
    flex-direction: column;

    gap: 10px;

    padding: 0 12px;
}


.product {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    padding: 14px;

    background: var(--section);
    border-radius: var(--radius);

    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}


.product-info {
    min-width: 0;
    flex: 1;
}


.product-name {
    font-size: 16px;
    font-weight: 650;

    overflow: hidden;
    text-overflow: ellipsis;
}


.product-price {
    margin-top: 4px;

    color: var(--hint);

    font-size: 14px;
}


.quantity {
    display: flex;
    align-items: center;

    gap: 7px;
}


.quantity button {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 38px;
    height: 38px;

    border-radius: 12px;

    background: var(--secondary-bg);
    color: var(--text);

    font-size: 22px;
    font-weight: 500;
}


.quantity-value {
    width: 28px;

    text-align: center;

    font-size: 16px;
    font-weight: 650;
}


.cart-bar {
    position: fixed;

    left: 0;
    right: 0;
    bottom: 0;

    z-index: 20;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    padding:
        10px
        max(12px, calc((100vw - 700px) / 2 + 12px))
        calc(10px + env(safe-area-inset-bottom));

    background: var(--bg);

    border-top: 1px solid rgba(127, 127, 127, 0.15);

    backdrop-filter: blur(10px);
}


.cart-label {
    font-size: 15px;
    font-weight: 650;
}


#cartSummary {
    margin-top: 2px;

    color: var(--hint);
    font-size: 12px;
}


.cart-button {
    min-width: 145px;

    padding: 12px 17px;

    border-radius: 13px;

    background: var(--button);
    color: var(--button-text);

    font-weight: 650;
}


.cart-button span {
    margin-left: 6px;
}


.modal {
    position: fixed;

    inset: 0;

    z-index: 100;
}


.modal-overlay {
    position: absolute;

    inset: 0;

    background: rgba(0, 0, 0, 0.45);
}


.modal-sheet {
    position: absolute;

    left: 0;
    right: 0;
    bottom: 0;

    max-height: 90vh;

    overflow-y: auto;

    padding: 18px 16px calc(20px + env(safe-area-inset-bottom));

    background: var(--bg);

    border-radius: 20px 20px 0 0;
}


.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 14px;
}


.modal-header h2 {
    margin: 0;

    font-size: 21px;
}


.close-button {
    width: 38px;
    height: 38px;

    border-radius: 50%;

    background: var(--secondary-bg);
    color: var(--text);

    font-size: 25px;
}


.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    padding: 13px 0;

    border-bottom: 1px solid rgba(127, 127, 127, 0.15);
}


.cart-item-info {
    flex: 1;
    min-width: 0;
}


.cart-item-name {
    font-weight: 600;
}


.cart-item-price {
    margin-top: 4px;

    color: var(--hint);
    font-size: 13px;
}


.cart-item-total {
    margin-top: 4px;

    font-size: 14px;
    font-weight: 650;
}


.cart-footer {
    margin-top: 18px;
}


.total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 14px;

    font-size: 18px;
}


.total-row strong {
    font-size: 21px;
}


.confirm-button {
    width: 100%;

    padding: 14px;

    border-radius: 14px;

    background: var(--button);
    color: var(--button-text);

    font-size: 16px;
    font-weight: 700;
}


.empty,
.empty-cart,
.screen {
    padding: 60px 25px;

    text-align: center;
}


.empty-icon {
    margin-bottom: 12px;

    font-size: 42px;
}


.empty h3,
.empty-cart h3,
.screen h2 {
    margin: 8px 0;
}


.empty p,
.empty-cart p,
.screen p {
    margin: 5px 0;

    color: var(--hint);
}


.success-screen {
    position: fixed;

    inset: 0;

    z-index: 200;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 30px;

    background: var(--bg);

    text-align: center;
}


.success-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 78px;
    height: 78px;

    margin-bottom: 22px;

    border-radius: 50%;

    background: #27ae60;
    color: white;

    font-size: 45px;
}


.success-screen h1 {
    margin: 0 0 10px;
}


.success-screen p {
    margin: 0 0 25px;

    color: var(--hint);

    line-height: 1.5;
}


.success-screen .confirm-button {
    max-width: 350px;
}


.loader {
    position: fixed;

    inset: 0;

    z-index: 300;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(0, 0, 0, 0.15);
}


.spinner {
    width: 38px;
    height: 38px;

    border: 4px solid rgba(127, 127, 127, 0.25);
    border-top-color: var(--button);

    border-radius: 50%;

    animation: spin 0.8s linear infinite;
}


.hidden {
    display: none !important;
}


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