a, button, .category-chip, .product-card, .btn, .sheet-icon-btn, .avatar-option {
    touch-action: manipulation; /* Remove 300ms tap delay */
    user-select: none; /* Prevent accidental text selection */
    -webkit-user-select: none;
}

:root {
    /* Цветовая палитра */
    --bg-color: #ffffff;
    --surface-color: #FFFFFF;
    --text-primary: #000000;
    --text-secondary: #444444;
    --accent-color: #f9e532;
    --accent-hover: #e0ce2d;
    --border-color: #d1d1d1;

    --shadow-sm: 0 4px 6px rgba(44, 34, 30, 0.05);
    --shadow-md: 0 8px 15px rgba(44, 34, 30, 0.08);
    --shadow-lg: 0 20px 25px rgba(44, 34, 30, 0.1);

    --border-radius: 20px;
    --card-radius: 24px;

    --font-main: 'Inter', sans-serif;
    --font-heading: 'NauryzRedKeds', 'Bebas Neue', sans-serif;
    --font-product: 'InterLocal', sans-serif;

    --safe-area-inset-top: env(safe-area-inset-top, 0px);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 20px);
    
    --font-size-base: clamp(14px, 4vw, 16px);
    --font-size-h: clamp(20px, 5vw, 24px);
    
    --ios-easing: cubic-bezier(0.32, 0.72, 0, 1);
    --ios-easing-sheet: cubic-bezier(0.32, 0.72, 0, 1);

    --ios-switch-bg: #e9e9ea;
    --ios-switch-active: #34c759;
}

@font-face {
    font-family: 'NauryzRedKeds';
    src: url('./NauryzRedKeds.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'InterLocal';
    src: url('./Inter-Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent !important; /* Global removal of gray highlight */
    -webkit-touch-callout: none;
}

@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Global Inertial Scroll */
.bottom-sheet, .modal-centered, .overflow-y-auto {
    -webkit-overflow-scrolling: touch !important;
}

/* Base scroll smoothness */
html, body {
    height: 100%;
    width: 100%;
    overflow-x: hidden;
    overscroll-behavior-y: none;
    -webkit-overflow-scrolling: touch; /* Unified iOS momentum scroll */
}

html {
    height: -webkit-fill-available;
    background-color: var(--bg-color);
    overscroll-behavior-y: none; /* Отключаем нативный pull-to-refresh */
}

img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
}

body {
    min-height: auto;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.5;
    font-size: var(--font-size-base);
    display: flex;
    flex-direction: column;
    padding-bottom: calc(90px + var(--safe-area-inset-bottom));
    overscroll-behavior-y: none;
}


.no-scroll {
    overflow: hidden !important;
    touch-action: none; /* Блокирует системные жесты на фоне */
}

/* Но при этом разрешаем тач-события внутри шторок */
.bottom-sheet {
    overscroll-behavior: contain; /* Предотвращает просачивание скролла на фон */
    touch-action: pan-y; /* Разрешает только вертикальный свайп внутри */
}

/* Скрываем полосу прокрутки для всех элементов */
*::-webkit-scrollbar {
    display: none !important;
}

* {
    -ms-overflow-style: none !important;  /* IE and Edge */
    scrollbar-width: none !important;  /* Firefox */
}

#app {
    display: flex;
    flex-direction: column;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    background-color: var(--bg-color);
    position: relative;
    min-height: auto;
}


@media (min-width: 601px) {
    #app {
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.03);
    }
}


/* Typography */
h1,
h2,
h3 {
    font-family: var(--font-heading);
    font-size: var(--font-size-h) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px;
    line-height: 1.1 !important;
    margin: 0 !important;
    min-height: 1.2em;
}

.section-title {
    margin-bottom: 1.5rem !important;
    padding: 0 1.25rem;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(0.7rem + var(--safe-area-inset-top, 0px)) 1.25rem 0.5rem !important;
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 100; /* Вернули в общий поток, чтобы хедер блюрился под оверлеем */
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.4) 0%, transparent 100%);
    color: #111;
}


.app-main {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.hero-gif-section {
    margin: 0 !important;
    padding: 0 !important;
    position: sticky;
    top: 0;
    display: block;
    z-index: 10;
    width: 100%;
    overflow: visible;
}

.menu-wrapper {
    position: relative;
    z-index: 20; /* Меню всегда выше гифки в плане слоев */
    background: var(--surface-color);
    display: flex;
    flex-direction: column;
    min-height: auto; /* Убираем возможные растягивания */
    height: auto;
}

#heroViewport {
    width: 100%;
    height: 50vh;
    min-height: 350px;
    overflow: hidden;
    transform-origin: top center;
    transition: transform 0.4s cubic-bezier(0, 0, 0.2, 1);

}



.header-left {
    flex: 1;
    display: flex;
    justify-content: flex-start;
}

.header-center {
    flex: 0;
    display: flex;
    justify-content: center;
}

.header-icon {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    cursor: pointer;
}

.location-select {
    background: transparent !important;
    border: none !important;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-primary);
    outline: none;
    cursor: pointer;
    appearance: none !important;
    -webkit-appearance: none !important;
}


/* Promo Banner */
.promo-section {
    margin: 2rem -1.25rem 0;
    overflow: hidden;
}

.brand-logo-wrapper {
    background-color: transparent;
    padding: 6px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.brand-logo-mask {
    background-color: var(--text-primary);
    width: 130px;
    height: 32px;
    -webkit-mask: url('logo/mainlogo.svg') no-repeat center;
    mask: url('logo/mainlogo.svg') no-repeat center;
    -webkit-mask-size: contain;
    mask-size: contain;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}




.promo-slider {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding: 0 1.25rem 1.5rem;
}

.promo-slider::-webkit-scrollbar {
    display: none;
}

.promo-banner {
    flex: 0 0 88%;
    aspect-ratio: 4 / 1.1; 
    /* Пропорция для сохранения высоты около 100px при ширине в 88% */
    background: linear-gradient(135deg, #F9E532 0%, #E3D251 100%);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    scroll-snap-align: center;
    box-shadow: var(--shadow-ios);
}

.promo-banner.student-banner {
    padding: 0;
    background: transparent;
    /* Убрал фон, чтобы не просвечивал */
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    /* Убрал рамку, которая могла создавать микро-полосы */
}

.promo-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1.02);
    /* Микро-зум, чтобы убрать зазоры по краям */

}

.promo-banner.student-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.promo-banner.student-banner::before {
    display: none !important;
}

.promo-banner::before {
    content: '🎓';
    position: absolute;
    right: -10px;
    bottom: -20px;
    font-size: 100px;
    opacity: 0.15;
    transform: rotate(-15deg);
}

.promo-content h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.promo-content p {
    font-size: 0.9rem;
    opacity: 0.95;
    max-width: 80%;
}

/* Categories Scroll */
.categories-section {
    padding-top: 1.5rem;
    margin-bottom: 1.5rem;
}

.categories-scroll {
    display: flex;
    overflow-x: auto;
    padding: 0 1.25rem 0.5rem;
    scrollbar-width: none;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    /* Firefox */
}

.categories-scroll::-webkit-scrollbar {
    display: none;
    /* Safari and Chrome */
}

.category-chip {
    background-color: transparent;
    border: none;
    color: #999999;
    padding: 0.25rem 0.5rem;
    font-size: 1.25rem;
    font-family: var(--font-heading);
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.15s cubic-bezier(0.1, 0, 0.2, 1);
    border-radius: 0;
    letter-spacing: 0.5px;
}

.category-chip:active {
    transform: scale(0.92);
}

.category-chip.active {
    background-color: transparent;
    border: none;
    color: var(--text-primary);
    box-shadow: none;
}

/* Info Plate Section */
.info-plate-section {
    padding: 0 1.25rem 3rem;
    position: relative;
    overflow: hidden;
}

.info-plate {
    background: #F2F2F2;
    border-radius: var(--card-radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.info-line {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.info-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-details {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.info-socials {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.info-link {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.05rem;
    display: inline-block;
}

.info-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.1rem;
}

.info-social-link {
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    opacity: 0.8;
}

.info-social-link svg {
    width: 24px;
    height: 24px;
}

.info-social-link:hover {
    opacity: 1;
    transform: translateY(-2px);
}

.info-social-link.vk {
    color: #4C75A3;
}

.info-social-link.tg {
    color: #0088CC;
}

.info-social-link.yt {
    color: #FF0000;
}


/* Swiper (iOS Style) */
.menu-track,
.hero-track {
    display: flex;
    width: 100%;
    transition: transform 0.3s cubic-bezier(0.1, 0, 0.2, 1);

}

.hero-track {
    height: 100%;
    transform-origin: center center;
    /* Изменено с top для компенсации зазора */
    transition: transform 0.4s cubic-bezier(0.1, 0, 0.2, 1), scale 0.4s cubic-bezier(0.1, 0, 0.2, 1);
}

#heroViewport.pulling-active {
    overflow: visible !important;
}

.menu-track.no-transition,
.hero-track.no-transition {
    transition: none !important;
}

.menu-track {
    display: flex;
    width: 100%;
    align-items: flex-start;
}

.menu-track.is-swiping .category-page {
    display: flex !important;
    max-height: none !important;
    height: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    /* Показываем весь контент для бесшовного свайпа */
    overflow-y: visible !important;
    pointer-events: auto !important;
}

.menu-track {
    display: flex;
    width: 100%;
    align-items: flex-start;
    will-change: transform;
}

.category-page,
.hero-page {
    flex: 0 0 100%;
    width: 100%;
    min-width: 100%;
    box-sizing: border-box;
}

.hero-page {
    height: 100%;
}

.category-page {
    flex: 0 0 100%;
    width: 100%;
    min-width: 100%;
    padding: 0 1.25rem calc(110px + var(--safe-area-inset-bottom)); /* Запас для корзины + 20px */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    /* Устраняем "бездны": неактивные страницы не занимают места */
    height: 0;
    min-height: auto;
    overflow: hidden;
    visibility: hidden;
    opacity: 1;
    pointer-events: none;
    will-change: transform;
}

.category-page.active {
    height: auto;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

/* При перетягивании (класс на родителе) показываем соседей */
.menu-track.is-dragging .category-page {
    height: auto;
    visibility: visible;
    opacity: 1;
    overflow: visible;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    opacity: 1;
    align-items: stretch;
}

/* Растягивание последней карточки на всю ширину при нечётном количестве (вертикальный вид) */
.product-grid>.product-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

.product-grid>.product-card:last-child:nth-child(odd) .product-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    height: auto;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.product-grid>.product-card:last-child:nth-child(odd) .product-title {
    font-size: 1.2rem;
}

/* Footer Schedule */
.schedule {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    margin-bottom: 1.2rem;
    align-items: center;
}

.schedule-label {
    font-size: var(--font-size-h);
    opacity: 1;
    font-family: var(--font-heading);
    text-transform: uppercase;
}

.schedule-time {
    font-size: var(--font-size-h);
    font-weight: 500;
    font-family: var(--font-heading);
    text-transform: uppercase;
}

/* Удаляем старые анимации появления */
.product-grid.slide-in-right,
.product-grid.slide-in-left,
#heroViewport.slide-in {
    animation: none !important;
}

.product-card {
    background-color: var(--surface-color);
    border-radius: var(--card-radius);
    padding: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.1s cubic-bezier(0.1, 0, 0.2, 1), box-shadow 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.03);
    min-width: 0;
}

.product-card:active {
    transform: scale(0.96);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
}

.product-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    background-color: #F5EFEB;
    border-radius: 20px;
    margin-bottom: 1rem;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-family: var(--font-product);
    text-transform: none !important; /* Убираем капслок */
    line-height: 1.25;
    min-height: 2.6rem;
    /* Минимальная высота для выравнивания кнопок */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

.product-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.product-price {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-primary);
    font-family: var(--font-product);
}

.add-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: #111111;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
}

/* Floating Cart Widget */
.floating-cart {
    position: fixed;
    bottom: calc(1.5rem + var(--safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    border-radius: 28px;
    padding: 0.8rem 1.4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 900;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
}

.floating-cart:active {
    transform: translateX(-50%) scale(0.96);
}

.fc-info {
    display: flex;
    flex-direction: column;
}

.fc-sum {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.fc-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.fc-avatars {
    display: flex;
    align-items: center;
}

.fc-avatar {
    width: 36px;
    height: 36px;
    border-radius: 18px;
    object-fit: cover;
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

.fc-avatar:not(:first-child) {
    margin-left: -12px;
}

/* Overlays and Modals */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* Затемнение 0.5 по ТЗ */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    opacity: 1;
    visibility: visible;
    transition: opacity 200ms ease, visibility 200ms ease;
}

.overlay.view-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    display: block !important; /* Убеждаемся, что display: none от общего класса не срабатывает сразу */
}

/* Base Modal (Legacy) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--bg-color);
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border-top-left-radius: 32px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    box-shadow: none;
    /* Убираем тень по умолчанию */
    visibility: hidden;
    /* Скрываем из отрисовки в закрытом состоянии */
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.1);
    visibility: visible;
}

.close-modal {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: var(--surface-color);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    z-index: 10;
}

.modal-image {
    width: 100%;
    height: 250px;
    background-color: var(--surface-color);
    border-radius: 24px;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-details h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.modal-details p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

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

.modal-price {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-product);
}

.add-to-cart-btn {
    background-color: var(--accent-color);
    color: #111111;
    border: none;
    padding: 1rem 2rem;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(227, 210, 81, 0.3);
    transition: transform 0.2s ease;
}

.add-to-cart-btn:active {
    transform: scale(0.96);
}

/* App Views & Nav Logic */
.view-hidden {
    display: none !important;
}

.nav-icon-wrapper {
    position: relative;
    display: inline-flex;
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -8px;
    background: var(--accent-color);
    color: #111111;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 4px;
    border: 1.5px solid var(--surface-color);
}

/* Cart Screen */
.cart-items-container {
    padding: 0 0 0;
    display: flex;
    flex-direction: column;
}

.cart-items-group {
    background: var(--surface-color);
    border-radius: 20px;
    margin: 0 1.25rem 0.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 4rem 1rem;
    font-size: 1.1rem;
}

.cart-item-wrapper {
    position: relative;
    overflow: hidden;
    margin-bottom: 0.75rem;
    border-radius: 20px;
}

.cart-item-swipe-bg {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 80px;
    background: #ff4d4f;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    z-index: 1;
    border-radius: 20px;
}

.cart-item {
    background: var(--surface-color);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 2;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: var(--shadow-sm);
    border-radius: 20px;
}

.cart-item.swiping-left {
    transition: none;
}

.cart-item.deleted {
    transform: translateX(-110%) !important;
    opacity: 0;
}

.cart-item-img {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: cover;
    background: #f0f0f0;
}

.cart-item-info {
    flex-grow: 1;
}

.cart-item-title {
    font-weight: 600;
    margin-bottom: 0.2rem;
    font-size: 0.95rem;
}

.cart-item-price {
    font-weight: 700;
    color: var(--text-primary);
}

/* Cart Qty Control */
.cart-qty-ctrl {
    display: flex;
    align-items: center;
    background: #f4f4f4;
    border-radius: 12px;
    padding: 2px;
}

.qty-btn {
    background: transparent;
    border: none;
    width: 28px;
    height: 28px;
    font-size: 1.2rem;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.qty-btn:active {
    background: #e0e0e0;
}

.qty-val {
    width: 20px;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
}

/* Cross-sell Container */
.cross-sell-section {
    margin-top: 1.5rem;
}

.cross-sell-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding: 0 1.25rem;
}

.cross-sell-scroll {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding: 0 1.25rem 2rem;
    scrollbar-width: none;
}

.cross-sell-scroll::-webkit-scrollbar {
    display: none;
}

.cross-sell-card {
    min-width: 120px;
    background: var(--surface-color);
    border-radius: 16px;
    padding: 0.75rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cross-sell-img {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    object-fit: cover;
    background: #eee;
    flex-shrink: 0;
}

.cross-sell-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cross-sell-name {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
    line-height: 1.2;
}

.cross-sell-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.cross-sell-price {
    font-weight: 700;
    font-size: 0.9rem;
}

.cross-sell-add {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent-color);
    color: #111;
    border: none;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.cross-sell-add:active {
    transform: scale(0.9);
}

.cart-footer {
    position: fixed;
    bottom: calc(70px + var(--safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    background: var(--surface-color);
    padding: 1.25rem;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.04);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 90;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
    color: var(--text-secondary);
}

.cart-total-row strong {
    font-size: 1.4rem;
    color: var(--text-primary);
}

.checkout-btn {
    background: var(--accent-color);
    color: #111111;
    border: none;
    padding: 1.1rem;
    border-radius: 16px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 6px 15px rgba(227, 210, 81, 0.2);
    transition: transform 0.15s cubic-bezier(0.1, 0, 0.2, 1);
}

.checkout-btn:active {
    transform: scale(0.96);
    background-color: var(--accent-hover);
}

/* Profile Screen */
.profile-card {
    margin: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
}

.profile-avatar {
    width: 60px;
    height: 60px;
    background: #F5EFEB;
    border-radius: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--accent-color);
}

.profile-info h3 {
    margin-bottom: 0.1rem;
    font-size: 1.2rem;
}

.profile-info p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.profile-menu {
    margin: 1.5rem 1.25rem;
    background: var(--surface-color);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.profile-menu-item {
    display: flex;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
    cursor: pointer;
}

.profile-menu-item:last-child {
    border-bottom: none;
}

.text-danger {
    color: #ff4b4b;
}

/* About & Footer */
.about-card {
    margin: 0 1.25rem 2rem;
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    line-height: 1.6;
}

.about-card h3 {
    margin-bottom: 0.5rem;
}

.app-footer {
    padding: 1.5rem 1.25rem 1rem;
    text-align: center;
    color: var(--text-secondary);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.social-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.footer-address {
    font-size: 0.85rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.footer-copy {
    font-size: 0.75rem;
    opacity: 0.6;
}

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: 100%;
    max-width: 600px;
    background: var(--surface-color);
    border-top-left-radius: 28px;
    border-top-right-radius: 28px;
    padding: 0;
    z-index: 1010;
    transition: transform 220ms ease-in; /* Время закрытия по умолчанию */

    max-height: 100dvh;
    overflow-y: auto;
    visibility: hidden;
}

.bottom-sheet.show {
    transform: translateX(-50%) translateY(0);
    transition: transform 280ms var(--ios-easing); /* Время открытия по ТЗ */
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.1);
    visibility: visible;
}

@media (max-width: 600px) {
    .bottom-sheet {
        max-width: 100% !important;
        height: 85% !important; /* Возвращаем 85% для основных окон (Товар, Корзина) */
        max-height: 85% !important;
        border-top-left-radius: 28px !important;
        border-top-right-radius: 28px !important;
    }
    
    /* Исключение для маленьких шторок и окна "Подробнее" */
    #ingredientsSheet, #settingsSheet, #emailSheet, #paymentSheet, #addCardSheet, #aboutSheet, #feedbackSheet, #deleteAccountModal, #logoutModal {
        height: auto !important;
        max-height: 85% !important;
    }
    
    #app {
        max-width: 100% !important;
    }
}



/* White Cart override */
#cartSheet {
    background: #FFFFFF;
    border-top-left-radius: 32px;
    border-top-right-radius: 32px;
}

/* Modal Stacking System v18.21 */

/* Level 1: Base Modals (Cart, Profile, Product) */
#profileOverlay, #productOverlay, #cartOverlay { z-index: 1000; }
#profileSheet, #productSheet, #cartSheet { z-index: 1010; }

/* Level 2: Sub-modals (Settings) */
#settingsOverlay { z-index: 1020; }
#settingsSheet { z-index: 1030; }

/* Level 3: Top-level Modals (About, Feedback, Email, Payment, Ingredients, AvatarPicker) */
#aboutOverlay, #feedbackOverlay, #emailOverlay, #paymentOverlay, #addCardOverlay, #ingredientsOverlay, #avatarPickerOverlay, #deleteAccountOverlay { 
    z-index: 1040; 
}
#aboutSheet, #feedbackSheet, #emailSheet, #paymentSheet, #addCardSheet, #ingredientsSheet, #avatarPickerSheet, #deleteAccountModal { 
    z-index: 1050; 
}



.sheet-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--surface-color);
    display: flex;
    justify-content: space-between;
    align-items: center !important;
    height: auto !important;
    min-height: 90px !important;
    padding: 1.5rem 1.25rem 0.5rem !important; /* Увеличили верхний отступ до 1.5rem (24px) */
    box-sizing: border-box;
}

#addCardSheet .sheet-header {
    padding-top: 0.4rem;
}

.sheet-icon-btn {
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-primary);
    font-size: 1.1rem;
}

/* Unified Liquid Glass Buttons (iOS 17-18 Style) for Sheets */
.sheet-icon-btn {
    min-height: 48px;
    height: 48px;
    width: 48px;
    min-width: 48px; /* ГАРАНТИЯ: не сплющит */
    flex-shrink: 0;   /* ГАРАНТИЯ: не сплющит во flex-контейнерах */
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #111;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4), 0 4px 15px rgba(0, 0, 0, 0.03);
    box-sizing: border-box;
    padding: 0;
    -webkit-appearance: none;
    outline: none;
}

/* Minimal Header Profile Icon */
.header-icon-btn {
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: transform 0.2s ease;
    padding: 0;
    -webkit-appearance: none;
    outline: none;
}

/* Interactive Buttons Global scale effect */
button:not(.no-anim), 
.sheet-icon-btn, 
.header-icon-btn, 
.add-btn, 
.checkout-btn, 
.size-opt {
    transition: transform 120ms ease, opacity 120ms ease, background-color 120ms ease;
    -webkit-tap-highlight-color: transparent;
}

button:active:not(.no-anim), 
.sheet-icon-btn:active, 
.header-icon-btn:active, 
.add-btn:active, 
.checkout-btn:active, 
.size-opt:active {
    transform: scale(0.96) !important;
}

/* Size Variants */
.sheet-icon-btn-large {
    width: 48px;
    height: 48px;
}

.sheet-icon-btn-xl {
    width: 52px;
    height: 52px;
}

/* Visual Overrides for context */
.sheet-icon-btn-solid {
    background-color: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

.text-danger {
    color: #ff4d4f !important;
}

/* Nutrition Layout */
.nutrition-row {
    display: flex;
    justify-content: center;
    gap: 1.25rem; /* Расстояние между элементами КБЖУ */
    margin-top: 1.5rem;
    flex-wrap: wrap;
    width: 100%;
}

.nutri-item {
    display: flex;
    flex-direction: column;
    align-items: center; /* Центрируем всё внутри (цифру и текст) */
    min-width: 60px;
}

.nutri-val {
    font-size: 1.15rem;
    font-weight: 500; /* Сделали еще тоньше (Medium) */
    color: var(--text-primary);
    line-height: 1.1;
    text-align: center;
}

.nutri-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 3px;
    font-weight: 500;
    text-align: center;
}

/* Product Sheet Cart Capsule */
.sheet-cart-capsule {
    position: absolute;
    bottom: calc(1.5rem + var(--safe-area-inset-bottom));
    left: 2rem; /* Сделали чуть уже */
    right: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 8px 8px 12px; /* Увеличили высоту через padding */
    background: #ffffff;
    border-radius: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08), 0 0 1px rgba(0, 0, 0, 0.1);
    z-index: 10;
    transition: all 0.3s ease;
}

.size-selector {
    display: flex;
    position: relative;
    background: #f4f4f4;
    border-radius: 24px;
    padding: 3px;
    width: 180px; /* Увеличено со 165px для лучшей вместимости текста мл */
    height: 48px; /* Чуть увеличили высоту для лучшего баланса с новой шириной */
    align-items: stretch;
}

.size-indicator {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(33.333% - 4px);
    height: calc(100% - 6px);
    background: var(--accent-color);
    border-radius: 20px; /* Соответствует внешнему радиусу для эффекта вложенности */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 1;
}

.size-opt {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    position: relative;
    background: transparent;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.size-opt:active {
    transform: scale(0.9);
}

.size-opt .size-letter {
    font-weight: 600;
    font-size: 1.25rem; /* Чуть крупнее для баланса */
    color: var(--text-secondary);
    transition: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    transform: translateY(10px);
}

.size-opt .size-vol {
    font-size: 0.7rem;
    color: #111;
    font-weight: 300; /* Максимально тонкий */
    opacity: 0;
    transform: translateY(14px);
    transition: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.size-opt.active .size-letter {
    font-weight: 850;
    color: var(--text-primary);
    transform: translateY(-2px);
}

.size-opt.active .size-vol {
    opacity: 1;
    transform: translateY(-5px); /* Еще ближе, почти вплотную */
}

.capsule-add-btn {
    background: #fce311;
    border: none;
    padding: 0 1.5rem;
    height: 48px;
    border-radius: 24px;
    font-family: var(--font-product);
    font-size: 1.25rem;
    font-weight: 700;
    cursor: pointer;
    color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
}

/* Modal Centered */
.modal-centered {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 28px;
    width: 90%;
    max-width: 400px;
    z-index: 1021;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.close-modal-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
}

/* Support Dropdown */
.support-dropdown {
    position: absolute;
    top: 4rem;
    left: 1.5rem;
    background: var(--surface-color);
    box-shadow: var(--shadow-md);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    z-index: 102;
}

.support-dropdown a {
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
}

.support-dropdown a:last-child {
    border: none;
}

/* Profile Elements */
.profile-phone {
    color: var(--text-secondary);
}

/* Navigation stack for profile */
.profile-view-wrapper {
    position: relative;
    width: 100%;
    flex: 1;
    overflow: hidden;
}

.profile-main-view,
.profile-settings-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--surface-color);
    display: flex;
    flex-direction: column;
}

.profile-settings-view {
    transform: translateX(100%);
}

.profile-view-wrapper.show-settings .profile-main-view {
    transform: translateX(-30%);
    opacity: 0.5;
}

.profile-view-wrapper.show-settings .profile-settings-view {
    transform: translateX(0);
}

/* Settings List Rows */
.settings-list {
    display: flex;
    flex-direction: column;
    margin-top: 1rem;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    cursor: pointer;
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-row-left {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.settings-row-label {
    font-weight: 600;
    font-size: 1rem;
}

.settings-row-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Settings Groups (Plates) */
.settings-group {
    background: #f7f7f7;
    border-radius: 20px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.settings-group .settings-row {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.settings-group .settings-row:last-child {
    border-bottom: none;
}

.settings-row-value {
    font-weight: 500;
    color: #bbb;
}

.name-edit-input {
    border: none;
    background: transparent;
    text-align: right;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0;
    outline: none;
    width: 150px;
}

.name-edit-input::placeholder {
    color: #ccc;
}

/* Apple Style Toggle */
.ios-switch {
    position: relative;
    display: inline-block;
    width: 51px;
    height: 31px;
}

.ios-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ios-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--ios-switch-bg);
    transition: .4s;
    border-radius: 34px;
}

.ios-slider:before {
    position: absolute;
    content: "";
    height: 27px;
    width: 27px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

input:checked+.ios-slider {
    background-color: var(--ios-switch-active);
}

input:checked+.ios-slider:before {
    transform: translateX(20px);
}

.profile-card-clickable {
    background: #f7f7f7;
    padding: 1rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.profile-card-clickable:active {
    transform: scale(0.98);
}

.settings-input-row {
    overflow: hidden;
    max-height: 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease;
}

.settings-input-row.open {
    max-height: 100px;
}

.settings-email-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    border: 1px solid #eee;
    background: #fdfdfd;
    font-family: inherit;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}




/* Order History */
.history-item {
    display: flex;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item-img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
}

.history-item-info {
    flex: 1;
}

.history-item-title {
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.history-item-price {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    margin-top: 4px;
}

.repeat-btn {
    background: var(--surface-color);
    border: 2px solid var(--accent-color);
    border-radius: 12px;
    padding: 0.5rem;
    cursor: pointer;
    color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.repeat-btn:active {
    background: var(--accent-color);
}

.product-accordion summary::-webkit-details-marker {
    display: none;
}

.product-accordion[open] .accordion-arrow {
    transform: rotate(180deg);
}

.accordion-arrow {
    transition: transform 0.3s;
}

.heart-btn.active svg {
    fill: #ff4d4f;
    stroke: #ff4d4f;
    transform: scale(1.15);
}

.heart-btn svg {
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Size Selectors Restored - Cleaned up to avoid overlapping backgrounds and bold text */
.size-opt.active .size-letter {
    color: #111 !important;
}

.size-opt.active .size-vol {
    opacity: 1 !important;
    font-weight: 300 !important; /* Убираем жирный, возвращаем тонкий */
}

.size-letter {
    width: 34px;
    height: 34px;
    border-radius: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    transition: all 0.3s;
    background: transparent;
    color: var(--text-primary);
}

.size-vol {
    font-size: 0.65rem;
    transition: all 0.3s;
    margin-top: 2px;
    color: var(--text-secondary);
    opacity: 0.5;
}

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--accent-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    /* Убираем transform из анимации, оставляем только прозрачность */
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 1;
    overflow: hidden;
    /* Форсируем аппаратное ускорение для стабильности с первого кадра */
    transform: translateZ(0);

}

#preloader.fade-out {
    opacity: 0;
    pointer-events: none;
}

.preloader-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.preloader-image-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.preloader-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Centered Modals */
.modal-centered {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 92%;
    max-width: 400px;
    background: #ffffff;
    border-radius: 40px;
    padding: 29px 1.8rem 2.5rem !important;
    z-index: 2200;
    text-align: center;
    box-shadow: 0 40px 100px rgba(0,0,0,0.3);
    opacity: 0;
    visibility: hidden;
    transition: transform 220ms ease-in, opacity 200ms ease; /* Время закрытия */
    overflow: visible !important; 
}

.overlay:not(.view-hidden) + .modal-centered,
.overlay:not(.view-hidden) .modal-centered {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
    transition: transform 280ms var(--ios-easing), opacity 200ms ease; /* Время открытия */
}

@media (max-width: 767px) {
    .modal-centered {
        left: 0 !important;
        top: auto !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        transform: translateY(100%) !important;
        border-radius: 32px 32px 0 0 !important;
        padding-bottom: calc(24px + var(--safe-area-inset-bottom)) !important;
    }
}

.overlay:not(.view-hidden) + .modal-centered,
.overlay:not(.view-hidden) .modal-centered {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

@media (max-width: 767px) {
    .overlay:not(.view-hidden) + .modal-centered,
    .overlay:not(.view-hidden) .modal-centered {
        transform: translateY(0) !important;
        opacity: 1;
        visibility: visible;
    }
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 22px; 
    line-height: 1.1;
    text-transform: uppercase;
    margin-top: 0 !important;
    margin-bottom: 1.5rem !important;
    color: #111;
    white-space: nowrap; /* По умолчанию в одну строку (для Выхода) */
}

#deleteAccountModal .modal-title {
    white-space: normal;
    text-align: center !important;
    width: 100%;
}

.modal-mascot-sync {
    width: 150px !important; /* Гарантированный размер 150px */
    margin: 0 auto 1.5rem;   /* Центрирование */
    overflow: visible !important;
}

.modal-mascot-sync img {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible !important;
}

.modal-text {
    font-size: 1.15rem;
    color: #111;
    line-height: 1.4;
    margin-bottom: 2.5rem;
    padding: 0 1rem;
    font-weight: 500;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.modal-actions button {
    width: 100%;
    min-height: 48px;
    padding: 0.8rem;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-primary {
    background: var(--accent-color);
    color: #111;
}

.btn-primary:active {
    background: var(--accent-hover);
    transform: scale(0.97);
}

.btn-outline-red {
    background: none;
    color: #ff4d4f;
    border: 1.5px solid #ff4d4f !important;
}

.btn-outline-red:active {
    background: rgba(255, 77, 79, 0.05);
    transform: scale(0.97);
}

/* Blur effect on overlay when modal is active */
#logoutOverlay {
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    background: rgba(0,0,0,0.3);
    z-index: 2150;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
/* --- Performance & Accessibility v18.99i --- */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Force Global Header Symmetry & Pure White Theme (Moved from index.html v19.40) */
.sheet-header {
    height: 72px !important;
    padding: 0 1.25rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: #ffffff !important;
    border-top-left-radius: 28px !important;
    border-top-right-radius: 28px !important;
}

.bottom-sheet {
    background: #ffffff !important;
}

.sheet-header h2,
.sheet-header h3 {
    display: block !important;
    text-align: center !important;
    margin: 0 auto !important;
    width: 100% !important;
}

.modal-centered h2,
.modal-centered h3,
.modal-title {
    display: block !important;
    text-align: center !important;
    margin: 0 auto 1.5rem !important;
    width: 100% !important;
}

h2,
h3 {
    margin: 0 !important;
    font-size: 22px !important;
    text-transform: uppercase !important;
    line-height: 1.1 !important;
}

.modal-centered {
    padding: 24px 1.8rem 2.5rem !important;
    background: #ffffff !important;
}

.modal-title {
    margin-top: 0 !important;
    margin-bottom: 1.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* --- PWA Install & Toast Styles v19.45 --- */
.meren-toast {
    position: fixed;
    bottom: 110px; /* Выше таббара если есть */
    left: 50%;
    transform: translateX(-50%) translateY(200px);
    background: #111;
    color: #fff;
    padding: 14px 28px;
    border-radius: 40px;
    font-size: 0.95rem;
    font-weight: 700;
    z-index: 10000;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}
.meren-toast.show {
    transform: translateX(-50%) translateY(0);
}

#installSheet, #iosInstallSheet {
    z-index: 10001 !important;
}
#installOverlay, #iosInstallOverlay {
    z-index: 10000 !important;
}
/* --- Auth Sheet & Login Flow --- */
.auth-screens-container {
    position: relative;
    flex: 1;
    width: 100%;
    overflow: hidden;
}

.auth-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px 24px;
    transition: transform 0.5s var(--ios-easing), opacity 0.3s ease;
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    background: var(--bg-color);
}

.auth-screen.active {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.auth-screen.prev {
    transform: translateX(-30%);
    opacity: 0;
}

.auth-hero {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 30px;
}

.auth-mascot {
    width: 130px;
    height: auto;
    display: block;
    margin: 0 auto;
    animation: authFloat 3s ease-in-out infinite;
}

@keyframes authFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.auth-title {
    font-family: var(--font-heading);
    font-size: 28px;
    line-height: 1.1;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.auth-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 24px;
}

.auth-input-group {
    margin-bottom: 16px;
}

.auth-label {
    font-size: 13px;
    font-weight: 700;
    color: #a1a1a1;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: block;
    letter-spacing: 0.5px;
}

.auth-input {
    width: 100%;
    height: 56px;
    padding: 0 20px;
    background: #f5f5f7;
    border: 1.5px solid transparent;
    border-radius: 18px;
    font-family: var(--font-main);
    font-size: 17px;
    outline: none;
    transition: all 0.2s;
}

.auth-input:focus {
    background: #fff;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(249, 229, 50, 0.15);
}

.sms-grid {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 24px 0;
}

.sms-cell {
    width: 56px;
    height: 68px;
    background: #f5f5f7;
    border: 2px solid transparent;
    border-radius: 16px;
    text-align: center;
    font-size: 24px;
    font-family: var(--font-heading);
    outline: none;
    transition: all 0.2s;
}

.sms-cell:focus {
    border-color: var(--accent-color);
    background: #fff;
    box-shadow: var(--shadow-md);
}

.social-auth-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-top: 24px;
}

.social-auth-btn {
    height: 56px;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.social-auth-btn:active {
    background: #f5f5f7;
    transform: scale(0.95);
}

.auth-footer {
    margin-top: auto;
    font-size: 12px;
    text-align: center;
    color: #999;
    padding-bottom: 20px;
}
