.menu-ai {
    position: relative;
}

.menu-ai-launcher {
    position: fixed;
    z-index: 1002;
    bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
    left: max(1rem, env(safe-area-inset-left, 0px));
    display: flex;
    align-items: center;
    gap: 0.65rem;
    max-width: min(100vw - 2rem, 360px);
    pointer-events: none;
}

[dir="rtl"] .menu-ai-launcher {
    left: auto;
    right: max(1rem, env(safe-area-inset-right, 0px));
    flex-direction: row-reverse;
}

.menu-ai-launcher-btn,
.menu-ai-launcher-teaser-wrap {
    pointer-events: auto;
}

.menu-ai-launcher-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--master-primary, #c62828);
    color: #fff;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.22);
    flex-shrink: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.menu-ai-launcher-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.28);
}

.menu-ai-launcher-btn__glyph {
    font-size: 1.25rem;
    line-height: 1;
}

.menu-ai-launcher-teaser-wrap {
    overflow: hidden;
    max-width: min(280px, calc(100vw - 6.5rem));
    flex-shrink: 1;
    min-width: 0;
    transition:
        max-width 0.55s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.48s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.48s cubic-bezier(0.4, 0, 0.2, 1),
        margin 0.5s ease;
    will-change: max-width, opacity, transform;
}

.menu-ai-launcher-teaser-wrap.menu-ai-launcher-teaser-wrap--hide {
    max-width: 0;
    opacity: 0;
    transform: translateX(-10px);
    margin-inline-end: 0;
    pointer-events: none;
}

[dir="rtl"] .menu-ai-launcher-teaser-wrap.menu-ai-launcher-teaser-wrap--hide {
    transform: translateX(10px);
}

.menu-ai-launcher-teaser {
    margin: 0;
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
    line-height: 1.35;
}

.menu-ai-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 0;
}

.menu-ai-overlay--hidden {
    display: none;
}

.menu-ai-overlay-backdrop {
    position: absolute;
    inset: 0;
    border: none;
    padding: 0;
    margin: 0;
    background: rgba(15, 23, 42, 0.55);
    cursor: pointer;
}

.menu-ai-sheet {
    --menu-ai-bg-deep: rgba(17, 24, 39, 0.45);
    position: relative;
    width: 100%;
    max-width: 520px;
    min-height: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
    animation: menuAiSheetIn 0.28s ease;
    overflow: hidden;
    background: var(--master-primary, #6d28d9);
    background-image:
        radial-gradient(ellipse 120% 80% at 10% 20%, rgba(255, 255, 255, 0.14) 0%, transparent 50%),
        radial-gradient(ellipse 100% 60% at 90% 80%, rgba(0, 0, 0, 0.18) 0%, transparent 45%),
        linear-gradient(
            165deg,
            color-mix(in srgb, var(--master-primary, #6d28d9) 75%, #1e1b4b) 0%,
            var(--master-primary, #6d28d9) 42%,
            color-mix(in srgb, var(--master-primary, #6d28d9) 55%, #0f172a) 100%
        );
}

@supports not (color: color-mix(in srgb, white, black)) {
    .menu-ai-sheet {
        background-image:
            radial-gradient(ellipse 120% 80% at 10% 20%, rgba(255, 255, 255, 0.12) 0%, transparent 50%),
            radial-gradient(ellipse 100% 60% at 90% 80%, rgba(0, 0, 0, 0.2) 0%, transparent 45%),
            linear-gradient(165deg, #4c1d95 0%, var(--master-primary, #6d28d9) 45%, #312e81 100%);
    }
}

@media (min-width: 540px) {
    .menu-ai-sheet {
        min-height: auto;
        max-height: min(92vh, 720px);
        margin: auto;
        border-radius: 20px;
        overflow: hidden;
    }

    .menu-ai-overlay {
        align-items: center;
        padding: 1rem;
    }
}

@keyframes menuAiSheetIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-ai-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: background 0.15s ease, transform 0.15s ease;
}

.menu-ai-close:hover {
    background: rgba(255, 255, 255, 0.32);
}

[dir="rtl"] .menu-ai-close {
    right: auto;
    left: 0.75rem;
}

.menu-ai-sheet__top {
    position: relative;
    z-index: 3;
    flex-shrink: 0;
    padding: 1.25rem 3rem 0.75rem 1.25rem;
    background: rgba(0, 0, 0, 0.12);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.menu-ai-title {
    margin: 0 0 0.75rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.menu-ai-progress-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.menu-ai-progress-num {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
}

.menu-ai-progress-track {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 99px;
    overflow: hidden;
    position: relative;
}

.menu-ai-progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-radius: 99px;
    background: #fff;
    width: 0;
    transition: width 0.28s ease;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.45);
}

.menu-ai-sheet__stage {
    position: relative;
    z-index: 1;
    flex: 1;
    display: grid;
    grid-template-columns: minmax(52px, 1fr) minmax(0, 420px) minmax(52px, 1fr);
    align-items: stretch;
    min-height: 0;
}

.menu-ai-decor {
    position: relative;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    padding: 0.75rem 0;
    overflow: hidden;
}

.menu-ai-decor__blob {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.menu-ai-decor--left .menu-ai-decor__blob--1 {
    width: min(160px, 42vw);
    height: min(160px, 42vw);
    top: 8%;
    left: -18%;
}

.menu-ai-decor--right .menu-ai-decor__blob--2 {
    width: min(140px, 38vw);
    height: min(140px, 38vw);
    bottom: 12%;
    right: -12%;
}

.menu-ai-decor__icon {
    position: relative;
    z-index: 1;
    color: rgba(255, 255, 255, 0.28);
    line-height: 1;
    text-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.menu-ai-decor__icon--lg {
    font-size: clamp(2.25rem, 8vw, 3.5rem);
    transform: rotate(-10deg);
}

.menu-ai-decor__icon--md {
    font-size: clamp(1.6rem, 5.5vw, 2.35rem);
    transform: rotate(8deg);
}

.menu-ai-decor__icon--sm {
    font-size: clamp(1.2rem, 4vw, 1.75rem);
    transform: rotate(-6deg);
}

.menu-ai-decor--left .menu-ai-decor__icon:nth-of-type(3) {
    margin-inline-start: -6px;
}

.menu-ai-decor--right .menu-ai-decor__icon:nth-of-type(3) {
    margin-inline-end: -4px;
}

.menu-ai-body {
    position: relative;
    z-index: 2;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0.75rem calc(1rem + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
}

.menu-ai-panel:not(#menuAiStepLoading):not(#menuAiStepResult) {
    padding-top: min(8vh, 2.75rem);
}

@media (max-width: 360px) {
    .menu-ai-sheet__stage {
        grid-template-columns: minmax(40px, 0.65fr) minmax(0, 1fr) minmax(40px, 0.65fr);
    }
}



.menu-ai-panel[hidden] {
    display: none !important;
}

.menu-ai-panel:not([hidden]):not(#menuAiStepLoading):not(#menuAiStepResult) {
    animation: menuAiFade 0.25s ease;
}

@keyframes menuAiFade {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-ai-panel {
    width: 100%;
    max-width: 22rem;
}

.menu-ai-q {
    margin: 0 0 1.1rem;
    font-size: clamp(1rem, 4vw, 1.12rem);
    font-weight: 600;
    color: #fff;
    line-height: 1.45;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.menu-ai-chips {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0.55rem;
    align-items: stretch;
    justify-content: flex-start;
    width: 100%;
}

.menu-ai-chip {
    appearance: none;
    width: 100%;
    min-height: 3.75rem;
    height: 3.75rem;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 14px;
    padding: 0.4rem 0.85rem;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.25;
    color: #1e293b;
    cursor: pointer;
    word-break: break-word;
    overflow: hidden;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.menu-ai-chip:hover {
    transform: translateY(-2px);
    border-color: #fff;
    background: #fff;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

.menu-ai-chip:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.menu-ai-loading {
    text-align: center;
    padding: 2rem 0;
}

.menu-ai-spinner {
    width: 44px;
    height: 44px;
    margin: 0 auto 1rem;
    border: 4px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: menuAiSpin 0.8s linear infinite;
    transform-origin: center center;
    box-sizing: border-box;
}

@keyframes menuAiSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.menu-ai-loading-msg {
    margin: 0;
    min-height: 2.75em;
    color: rgba(255, 255, 255, 0.92);
    font-weight: 500;
    transition: opacity 0.35s ease;
}

.menu-ai-loading-msg.menu-ai-loading-msg--pulse {
    animation: menuAiPhraseIn 0.45s ease;
}

@keyframes menuAiPhraseIn {
    from {
        opacity: 0.25;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-ai-result-title {
    margin: 0 0 0.5rem;
    padding-top: 0.35rem;
    font-size: 1.05rem;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    scroll-margin-top: 1rem;
}

.menu-ai-result-body {
    margin: 0 0 1rem;
}

.menu-ai-result-intro {
    margin: 0 0 0.85rem;
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.5;
}

.menu-ai-result-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.menu-ai-result-row {
    padding: 0.65rem 0.75rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.menu-ai-result-row__title {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
}

.menu-ai-result-row__meta {
    margin: 0 0 0.35rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.82);
}

.menu-ai-result-row__reason {
    margin: 0;
    font-size: 0.84rem;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.45;
}

.menu-ai-result-text {
    margin: 0 0 1.25rem;
    font-size: 0.94rem;
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.55;
}

.menu-ai-outline-btn {
    width: 100%;
    max-width: 280px;
    padding: 0.7rem 1rem;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.95);
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.menu-ai-outline-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.menu-ai-step-footer {
    margin-top: 1.1rem;
    width: 100%;
    display: flex;
    justify-content: center;
}

.menu-ai-back-btn {
    appearance: none;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border-radius: 999px;
    padding: 0.52rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background 0.15s ease;
}

.menu-ai-back-btn:hover {
    background: rgba(255, 255, 255, 0.24);
}

.menu-ai-result-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: 100%;
    max-width: 280px;
    margin: 0.5rem auto 0;
    align-items: stretch;
}

.menu-ai-outline-btn--secondary {
    background: transparent;
    color: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.58);
}

.menu-ai-outline-btn--secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
    transform: translateY(0);
}

.menu-ai-results {
    width: 100%;
    max-width: 100%;
    text-align: center;
}

.menu-ai-result-card {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 16px;
    overflow: hidden;
    text-align: left;
}

.menu-ai-result-card--hero {
    position: relative;
    margin-bottom: 1.15rem;
    border-radius: 20px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.08) 55%, rgba(15, 23, 42, 0.15) 100%);
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.55),
        0 20px 40px rgba(0, 0, 0, 0.35);
}

.menu-ai-card__ribbon {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    max-width: calc(100% - 20px);
}

.menu-ai-card__ribbon span {
    display: inline-block;
    padding: 0.28rem 0.65rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #0f172a;
    background: linear-gradient(90deg, #fde68a, #fbbf24);
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

[dir="rtl"] .menu-ai-card__ribbon {
    left: auto;
    right: 10px;
}

.menu-ai-card__media {
    position: relative;
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
}

.menu-ai-result-card--hero .menu-ai-card__media {
    aspect-ratio: 16 / 10;
    max-height: 225px;
}

.menu-ai-result-card--pair .menu-ai-card__media {
    aspect-ratio: 4 / 3;
    max-height: 225px;
}

.menu-ai-card__media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.menu-ai-card__body {
    padding: 0.7rem 0.85rem 0.9rem;
}

.menu-ai-card__title {
    margin: 0 0 0.35rem;
    font-size: 0.98rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

.menu-ai-result-card--pair .menu-ai-card__title {
    font-size: 0.88rem;
}

.menu-ai-card__price {
    margin: 0 0 0.45rem;
    font-size: 0.86rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.88);
}

.menu-ai-card__stockout {
    margin: 0;
    font-size: 0.8rem;
    color: rgba(254, 226, 226, 0.95);
}

.menu-ai-result-card .btn-add-to-cart.menu-ai-card__cart {
    width: 100%;
    justify-content: center;
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.95);
    color: #0f172a;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.menu-ai-result-card .btn-add-to-cart.menu-ai-card__cart:hover {
    background: #fff;
}

.menu-ai-pairs-heading {
    margin: 0 0 0.55rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    text-align: left;
    width: 100%;
    letter-spacing: 0.02em;
}

.menu-ai-pairs-rail {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0.15rem 0 0.85rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    scrollbar-width: thin;
}

.menu-ai-pairs-rail__cell {
    flex: 0 0 min(78vw, 260px);
    scroll-snap-align: start;
}

@media (min-width: 480px) {
    .menu-ai-pairs-rail__cell {
        flex-basis: 220px;
    }
}

.menu-ai-pairs-rail--single {
    overflow-x: visible;
    scroll-snap-type: none;
    flex-wrap: nowrap;
}

.menu-ai-pairs-rail--single .menu-ai-pairs-rail__cell {
    flex: 1 1 100%;
    min-width: 0;
    max-width: 100%;
    scroll-snap-align: none;
}

@media (min-width: 480px) {
    .menu-ai-pairs-rail--single .menu-ai-pairs-rail__cell {
        flex-basis: 100%;
    }
}

body.menu-ai-open-no-scroll {
    overflow: hidden;
    touch-action: none;
}
