/* KOBE e-menu: card layout with a photo hero, category cards, dish sheet and "My Order" list */

/* Kantumruy Pro for Khmer text only (SIL Open Font License, see fonts/kantumruy-pro/OFL.txt);
   the unicode-range keeps English text on the system font */
@font-face {
    font-family: "KOBE Khmer";
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url("../fonts/kantumruy-pro/KantumruyPro-Khmer.woff2") format("woff2");
    unicode-range: U+1780-17FF, U+19E0-19FF, U+200C-200D, U+25CC;
}

:root {
    --km-red: #d82028;
    --km-navy: #292d77;
    --km-ink: #1d1f45;
    --km-red-on-bg: #b3151c; /* the red, deepened so text stays readable on the beige page */
    --km-bg: #e5d4c5;
    --km-on-bg: #101828;
    --km-on-bg-muted: rgba(16, 24, 40, .72);
    --km-card: #ffffff;
    --km-soft: #f2f0f6;
    --km-photo-bg: #ebe4da;
    --km-text: #1f2137;
    --km-muted: #565970;
    --km-line: rgba(41, 45, 119, .12);
    --km-shadow: 0 6px 20px rgba(29, 31, 69, .08);
    --km-radius: 18px;
    --km-font: "KOBE Khmer", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body.km-body {
    margin: 0;
    min-height: 100vh;
    background: var(--km-bg);
    color: var(--km-text);
    font: 15px/1.45 var(--km-font);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    padding-bottom: calc(104px + env(safe-area-inset-bottom));
}
body.km-locked { overflow: hidden; }
.km-body img { display: block; max-width: 100%; }
.km-body button { font: inherit; color: inherit; }
.km-body a { color: inherit; }
.km-sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Japanese background: seigaiha waves drifting and sakura petals falling, behind everything ---------- */
/* Only transform and opacity animate, so phones move these on the graphics chip without repainting the page */
.km-bg { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.km-bg__waves {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: -80px; /* one pattern tile extra, so the drift never shows an edge */
    background: url("../images/seigaiha.svg") 0 0 / 80px 40px;
}
.km-bg--animated .km-bg__waves { animation: km-waves 40s linear infinite; will-change: transform; }
.km-bg--animated .km-bg__petal {
    position: absolute;
    top: -40px;
    left: var(--x);
    width: var(--s);
    height: calc(var(--s) * 1.25);
    background: url("../images/sakura-petal.svg") center / contain no-repeat;
    opacity: 0;
    animation: km-petal var(--t) linear var(--d) infinite;
    will-change: transform, opacity;
}
.km-bg__petal:nth-of-type(1) { --x: 5%; --y: 16vh; --r: 40deg; --s: 13px; --t: 19s; --d: -2s; }
.km-bg__petal:nth-of-type(2) { --x: 17%; --y: 62vh; --r: 130deg; --s: 10px; --t: 24s; --d: -11s; }
.km-bg__petal:nth-of-type(3) { --x: 28%; --y: 8vh; --r: 210deg; --s: 15px; --t: 21s; --d: -6s; }
.km-bg__petal:nth-of-type(4) { --x: 39%; --y: 74vh; --r: 300deg; --s: 11px; --t: 27s; --d: -17s; }
.km-bg__petal:nth-of-type(5) { --x: 50%; --y: 30vh; --r: 80deg; --s: 14px; --t: 18s; --d: -9s; }
.km-bg__petal:nth-of-type(6) { --x: 61%; --y: 88vh; --r: 170deg; --s: 10px; --t: 25s; --d: -21s; }
.km-bg__petal:nth-of-type(7) { --x: 71%; --y: 12vh; --r: 250deg; --s: 13px; --t: 22s; --d: -4s; }
.km-bg__petal:nth-of-type(8) { --x: 81%; --y: 52vh; --r: 20deg; --s: 16px; --t: 20s; --d: -14s; }
.km-bg__petal:nth-of-type(9) { --x: 90%; --y: 24vh; --r: 110deg; --s: 11px; --t: 26s; --d: -8s; }
.km-bg__petal:nth-of-type(10) { --x: 96%; --y: 68vh; --r: 320deg; --s: 12px; --t: 23s; --d: -19s; }
.km-bg__petal:nth-of-type(11) { --x: 11%; --y: 40vh; --r: 60deg; --s: 8px; --t: 16s; --d: -12s; }
.km-bg__petal:nth-of-type(12) { --x: 34%; --y: 92vh; --r: 150deg; --s: 9px; --t: 17s; --d: -3s; }
.km-bg__petal:nth-of-type(13) { --x: 45%; --y: 56vh; --r: 230deg; --s: 7px; --t: 15s; --d: -7s; }
.km-bg__petal:nth-of-type(14) { --x: 66%; --y: 36vh; --r: 310deg; --s: 9px; --t: 18s; --d: -15s; }
.km-bg__petal:nth-of-type(15) { --x: 76%; --y: 78vh; --r: 100deg; --s: 8px; --t: 16s; --d: -10s; }
.km-bg__petal:nth-of-type(16) { --x: 86%; --y: 6vh; --r: 200deg; --s: 7px; --t: 15s; --d: -1s; }
@keyframes km-waves { to { transform: translate3d(80px, 0, 0); } }
@keyframes km-petal {
    0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(0deg); }
    6% { opacity: .9; }
    25% { transform: translate3d(26px, 28vh, 0) rotate(95deg); }
    50% { transform: translate3d(-12px, 56vh, 0) rotate(180deg); }
    75% { transform: translate3d(30px, 84vh, 0) rotate(270deg); }
    94% { opacity: .9; }
    100% { opacity: 0; transform: translate3d(6px, 112vh, 0) rotate(360deg); }
}

/* Background picture (MENU_BG_SCENE) in place of the waves: it drifts slowly, with sunlight and pale petals over it */
.km-body--scene { --km-bg: #fbe3e9; }
.km-bg__scene {
    position: absolute;
    top: -4%;
    right: -4%;
    bottom: -4%;
    left: -4%; /* extra picture around the edges, so the drift never shows a gap */
    background: center 32% / cover no-repeat;
}
.km-bg__light { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: radial-gradient(70% 45% at 80% 6%, rgba(255, 244, 214, .75) 0%, rgba(255, 244, 214, 0) 100%); opacity: .3; }
.km-bg--animated .km-bg__scene { animation: km-scene 36s ease-in-out infinite alternate; will-change: transform; }
.km-bg--animated .km-bg__light { animation: km-light 9s ease-in-out infinite alternate; will-change: opacity; }
.km-body--scene .km-bg--animated .km-bg__petal { background-image: url("../images/sakura-petal-light.svg"); }
@keyframes km-scene { to { transform: scale(1.06) translate3d(-1.2%, -1%, 0); } }
@keyframes km-light { to { opacity: 1; } }

/* Picture behind: the logo sits on a white tile, and small text on a light pill. The picture is kept soft and pale
   (blurred, with a white wash, in the file itself) so large dark titles stay readable straight on it. */
.km-body--scene .km-logo { padding: 8px 10px; border-radius: 14px; background: #fff; box-shadow: 0 6px 16px rgba(29, 31, 69, .14); }
.km-body--scene .km-hero:not(.km-hero--image) .km-logo img { mix-blend-mode: normal; }
.km-body--scene .km-lang { background: rgba(255, 255, 255, .88); }
.km-body--scene .km-lang a[aria-current] { background: var(--km-red); color: #fff !important; }
.km-body--scene .km-menu__title { text-shadow: 0 0 12px rgba(255, 255, 255, .8); }
.km-body--scene .km-search-status, .km-body--scene #menu-content .km-empty { width: fit-content; padding: 4px 12px; border-radius: 12px; background: rgba(255, 255, 255, .82); color: var(--km-on-bg); }
.km-body--scene .km-search-status { margin: 16px 0 0; }
.km-body--scene #menu-content .km-empty { margin: 24px auto; }
@media (min-width: 640px) {
    .km-body--scene .km-logo { padding: 10px 14px; border-radius: 18px; }
}

/* ---------- Hero banner ---------- */
.km-hero-wrap { max-width: 912px; margin: 0 auto; padding: 8px; }
.km-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* height: 200px; */
    padding: 10px;
    overflow: hidden;
    border-radius: 16px;
    background: transparent center / cover no-repeat;
}
.km-hero__top { display: flex; align-items: center; gap: 8px; }
.km-hero__top > .km-iconbtn { flex: none; }
.km-hero__actions { display: flex; flex: none; gap: 8px; margin-left: auto; }
.km-hero__tagline {
    margin: 0;
    color: var(--km-on-bg);
    font-size: 15px;
    letter-spacing: .14em;
    text-align: center;
    text-transform: uppercase;
}
/* The logo gives way to the buttons on narrow phones */
.km-logo { flex: 0 1 136px; display: block; min-width: 64px; }
.km-logo img { width: 100%; height: auto; }
/* The logo is a JPG on white: multiply lets the white blend into the page */
.km-hero:not(.km-hero--image) .km-logo img { mix-blend-mode: multiply; }

.km-iconbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .45);
    color: #fff !important;
    font-size: 17px;
    text-decoration: none;
    cursor: pointer;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    transition: background .2s, transform .15s;
}
.km-iconbtn:hover { background: rgba(0, 0, 0, .65); }
.km-iconbtn:active { transform: scale(.93); }
.km-iconbtn--light { background: #fff; color: var(--km-ink) !important; box-shadow: 0 2px 10px rgba(0, 0, 0, .22); }
.km-iconbtn--light:hover { background: #fff; }

/* Language switch (ខ្មែរ | EN | 中文): the current language sits on a white pill */
.km-lang {
    display: flex;
    height: 40px;
    padding: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .45);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
.km-lang a {
    display: flex;
    align-items: center;
    padding: 0 11px;
    border-radius: 999px;
    color: var(--km-on-bg) !important;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    transition: background .2s;
}
.km-lang a:hover { background: rgba(255, 255, 255, .5); }
.km-lang a[aria-current] { background: #fff; color: var(--km-ink) !important; }
.km-lang a:focus-visible { outline: 3px solid var(--km-red); outline-offset: 1px; }
@media (max-width: 359px) {
    .km-lang a { padding: 0 7px; }
}
/* Wide letter-spacing breaks up Khmer and Chinese text */
.km-hero__tagline:lang(km), .km-hero__tagline:lang(zh) { letter-spacing: .04em; }

/* ---------- Sections ---------- */
.km-section { max-width: 960px; margin: 0 auto; padding: 18px 16px 8px; }
.km-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.km-section__title { margin: 0; color: var(--km-ink); font-size: 22px; font-weight: 750; letter-spacing: -.01em; }
.km-section__count { flex: none; color: var(--km-muted); font-size: 13px; }
.km-empty { margin: 24px 0; color: var(--km-muted); text-align: center; list-style: none; }
#menu-content .km-empty { color: var(--km-on-bg-muted); }

/* ---------- Favorite dishes slider (home): swipes natively, js/menu.js adds the dots and auto-advance ---------- */
.km-fav { max-width: 896px; margin: 0 auto; padding: 8px 16px 0; }
.km-fav__track {
    position: relative;
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 0 0 12px; /* room for the card shadow inside the scrolling track */
    overflow-x: auto;
    list-style: none;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.km-fav__track::-webkit-scrollbar { display: none; }
.km-fav__slide { flex: 0 0 88%; min-width: 0; scroll-snap-align: start; }
.km-fav__slide:only-child { flex-basis: 100%; }
.km-fav__card {
    position: relative;
    display: block;
    width: 100%;
    height: 210px;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 12px -6px rgba(0, 0, 0, .22);
    cursor: pointer;
    transition: opacity .3s;
}
.km-fav__card:hover { opacity: .9; }
.km-fav__card:focus-visible { outline: 3px solid var(--km-red); outline-offset: -3px; }
.km-fav__card img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.km-fav__card::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 75%;
    background: linear-gradient(0deg, rgba(10, 12, 32, .86) 0%, rgba(10, 12, 32, .62) 28%, rgba(10, 12, 32, .24) 58%, rgba(10, 12, 32, .06) 82%, rgba(10, 12, 32, 0) 100%);
}
.km-fav__text { position: absolute; left: 14px; right: 14px; bottom: 12px; z-index: 1; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; text-align: left; }
.km-fav__name {
    display: -webkit-box;
    overflow: hidden;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.km-fav__prices { display: flex; flex: none; flex-direction: column; align-items: flex-end; }
.km-fav .km-price, .km-fav .km-price small { color: #fff; }
.km-fav .km-badge { z-index: 1; }
.km-fav__dots { display: flex; justify-content: center; }
.km-fav__dot { width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; }
.km-fav__dot::before {
    content: "";
    display: block;
    width: 8px;
    height: 8px;
    margin: 8px auto;
    border-radius: 999px;
    background: rgba(16, 24, 40, .28);
    transition: width .25s, background .25s;
}
.km-fav__dot.is-active::before { width: 20px; background: var(--km-red); }
.km-fav__dot:focus-visible { outline: 2px solid var(--km-red); outline-offset: -2px; border-radius: 6px; }

/* ---------- Category cards (home): white card, photo on the right fading into white ---------- */
.km-section--cats { max-width: 896px; padding-top: 16px; }
.km-cat-grid { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 0; padding: 0; list-style: none; }
.km-cat {
    position: relative;
    isolation: isolate;
    display: block;
    height: 128px;
    overflow: hidden;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .1);
    text-decoration: none;
    transition: opacity .3s cubic-bezier(.22, 1, .36, 1), transform .3s cubic-bezier(.22, 1, .36, 1);
}
.km-cat img { position: absolute; top: 0; right: 0; z-index: -2; width: 70%; height: 100%; object-fit: cover; }
.km-cat::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(90deg, #fff 0%, #fff 30%, rgba(255, 255, 255, .88) 42%, rgba(255, 255, 255, .35) 60%, rgba(255, 255, 255, 0) 78%);
}
.km-cat__text { position: absolute; left: 16px; right: 34%; bottom: 16px; display: flex; flex-direction: column; gap: 4px; }
.km-cat__name { color: #0a0a0a; font-size: 20px; font-weight: 500; line-height: 1.1; letter-spacing: .02em; }
.km-cat__count { color: rgba(10, 10, 10, .7); font-size: 12px; }
.km-cat:hover { opacity: .75; }
.km-cat:active { transform: scale(.97); }
.km-cat:focus-visible { outline: 3px solid var(--km-red); outline-offset: 3px; }

/* ---------- Section tabs (sticky; the active tab follows the scroll) ---------- */
.km-tabs {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--km-bg);
    box-shadow: 0 1px 0 var(--km-line);
}
.km-tabs__inner { display: flex; align-items: center; max-width: 896px; margin: 0 auto; padding: 0 4px; }
/* ".km-tabs" in front outranks ".km-body button { color: inherit }", so the menu (bars) icon follows --km-on-bg */
.km-tabs .km-tabs__menu {
    flex: none;
    width: 44px;
    height: 54px;
    border: 0;
    background: none;
    color: var(--km-on-bg);
    font-size: 20px;
    cursor: pointer;
}
.km-tabs__list {
    position: relative;
    display: flex;
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    list-style: none;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.km-tabs__list::-webkit-scrollbar { display: none; }
.km-tab {
    display: block;
    padding: 16px 16px 16px;
    color: var(--km-on-bg) !important;
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    transition: color .2s;
}
.km-tab:hover, .km-tab.is-active { color: var(--km-red-on-bg) !important; }
.km-tabs__line {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 4px;
    border-radius: 4px 4px 0 0;
    background: var(--km-red);
    pointer-events: none;
    transition: transform .3s cubic-bezier(.22, 1, .36, 1), width .3s cubic-bezier(.22, 1, .36, 1);
}

/* ---------- Dish search (the tab bar's search button; it takes the place of the tabs while open) ---------- */
.km-search { display: none; flex: 1; align-items: center; gap: 4px; min-width: 0; height: 54px; margin: 0; padding-left: 4px; }
.km-tabs.is-searching .km-search { display: flex; }
.km-tabs.is-searching .km-tabs__list, .km-tabs.is-searching .km-tabs__menu { display: none; }
.km-search__field { position: relative; flex: 1; min-width: 0; }
.km-search__field > .fa { position: absolute; top: 50%; left: 14px; color: var(--km-muted); transform: translateY(-50%); pointer-events: none; }
.km-search__input {
    width: 100%;
    height: 40px;
    padding: 0 40px 0 38px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: var(--km-text);
    font: 16px var(--km-font); /* 16px or more, or iPhones zoom in on focus */
    -webkit-appearance: none;
    appearance: none;
}
.km-search__input::-webkit-search-cancel-button { -webkit-appearance: none; }
.km-search__input:focus { outline: 3px solid var(--km-red); outline-offset: 0; }
.km-tabs .km-search__clear {
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    border: 0;
    background: none;
    color: #9a9cb0;
    font-size: 18px;
    cursor: pointer;
}
.km-tabs .km-search__cancel { flex: none; height: 54px; padding: 0 10px; border: 0; background: none; color: var(--km-on-bg); font: 500 15px var(--km-font); cursor: pointer; }
.km-search-status { margin: 0; padding: 16px 8px 0; color: var(--km-on-bg-muted); font-size: 14px; }
.km-menu__section[hidden], .km-list > li[hidden] { display: none; }

/* ---------- Menu sections ---------- */
.km-menu { max-width: 896px; margin: 0 auto; padding: 0 8px; }
.km-menu__section { scroll-margin-top: 58px; padding-bottom: 8px; }
.km-menu__title { margin: 0; padding: 24px 8px 14px; color: var(--km-on-bg); font-size: 26px; font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }

/* ---------- Dish cards ---------- */
.km-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; }
.km-item {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    height: 100%;
    padding: 6px;
    overflow: hidden;
    border: 0;
    border-radius: 16px;
    background: var(--km-card);
    text-align: left;
    cursor: pointer;
    transition: opacity .3s, transform .2s cubic-bezier(.22, 1, .36, 1);
}
.km-item:hover { opacity: .75; }
.km-item:active { transform: scale(.985); }
.km-item:focus-visible { outline: 3px solid var(--km-red); outline-offset: 2px; }
.km-item__thumb { flex: none; width: 105px; height: 105px; overflow: hidden; border-radius: 12px; background: var(--km-photo-bg); }
.km-item__thumb img { width: 100%; height: 100%; object-fit: cover; }
.km-item__body { display: flex; flex: 1; flex-direction: column; justify-content: space-between; gap: 8px; min-width: 0; padding: 4px 6px 2px; }
.km-item__text { display: flex; flex-direction: column; gap: 4px; }
.km-item__name {
    display: -webkit-box;
    overflow: hidden;
    overflow-wrap: break-word;
    color: var(--km-text);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}
.km-item__name:not(:last-child) { -webkit-line-clamp: 2; }
.km-item--badge .km-item__name { padding-right: 80px; }
.km-item__desc {
    display: -webkit-box;
    overflow: hidden;
    color: rgba(31, 33, 55, .82);
    font-size: 13px;
    line-height: 1.4;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.km-item__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.km-item__prices, .km-dish__prices { display: flex; flex-direction: column; }
.km-price { color: var(--km-text); font-size: 16px; font-weight: 600; }
.km-price small { color: var(--km-muted); font-size: 12px; font-weight: 500; }
.km-item__code { flex: none; color: rgba(31, 33, 55, .68); font-size: 12px; }
.km-badge {
    position: absolute;
    top: 0;
    right: 0;
    padding: 3px 10px;
    border-radius: 0 16px 0 12px;
    background: var(--km-red);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}
.km-badge .fa { margin-right: 2px; }
.km-badge--favorite { background: var(--km-red); }
.km-nophoto { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: rgba(41, 45, 119, .3); font-size: 28px; }

/* ---------- Bottom sheets ---------- */
.km-sheet {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    visibility: hidden;
    transition: visibility 0s linear .32s;
}
.km-sheet.is-open { visibility: visible; transition-delay: 0s; }
.km-sheet__overlay { position: absolute; inset: 0; background: rgba(12, 14, 38, .5); opacity: 0; transition: opacity .25s; }
.km-sheet.is-open .km-sheet__overlay { opacity: 1; }
.km-sheet__panel {
    position: relative;
    width: 100%;
    max-width: 616px;
    max-height: 92vh;
    max-height: 92dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
    background: #fff;
    outline: none;
    transform: translateY(100%);
    transition: transform .32s cubic-bezier(.22, 1, .36, 1);
}
.km-sheet.is-open .km-sheet__panel { transform: translateY(0); }
.km-sheet__handle { width: 40px; height: 4px; margin: 0 auto 12px; border-radius: 4px; background: #dcd9e5; }
.km-sheet__close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 1px 6px rgba(0, 0, 0, .15);
    color: var(--km-ink);
    font-size: 16px;
    cursor: pointer;
}
.km-sheet__title { margin: 4px 0; padding-right: 44px; color: var(--km-ink); font-size: 20px; font-weight: 750; }
.km-muted { margin: 0 0 14px; color: var(--km-muted); font-size: 13.5px; }

/* ---------- Dish sheet: big photo, name and price, info pills ---------- */
#dish-sheet .km-sheet__panel { max-width: 986px; padding: 8px 8px calc(16px + env(safe-area-inset-bottom)); }
#dish-sheet .km-sheet__handle { display: none; }
#dish-sheet .km-sheet__close { top: 16px; right: 16px; }
.km-dish__media { position: relative; }
.km-dish__photo { aspect-ratio: 6 / 4; overflow: hidden; border-radius: 16px; background: var(--km-photo-bg); }
.km-dish__photo img { width: 100%; height: 100%; object-fit: cover; }
.km-badge--media { top: auto; bottom: 0; padding: 4px 12px; border-radius: 12px 0 16px 0; font-size: 15px; }
.km-dish__content { padding: 16px 8px 4px; }
.km-dish__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.km-dish__name { margin: 0; color: var(--km-text); font-size: 20px; font-weight: 600; line-height: 1.3; }
.km-dish__head .km-price { font-size: 24px; font-weight: 700; white-space: nowrap; }
.km-dish__desc { margin: 12px 0 0; color: #2b2d42; font-size: 16px; line-height: 1.5; }
.km-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
.km-pill { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 16px; background: #f3f4f6; color: var(--km-text); font-size: 14px; }
.km-pill .fa { color: rgba(31, 33, 55, .6); }
.km-pill--ok { background: rgba(30, 130, 60, .1); color: #1b7536; }
.km-pill--ok .fa { color: inherit; }
.km-dish__actions { margin-top: 18px; padding-top: 16px; border-top: 1px solid #e5e7eb; }
.km-note-added { display: flex; gap: 10px; }
.km-note-added .km-btn { flex: 1; }

/* ---------- All categories sheet (the tab bar's menu button) ---------- */
.km-section-links { margin: 12px 0 0; padding: 0; list-style: none; }
.km-section-links a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--km-line);
    color: var(--km-text) !important;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
}
.km-section-links a:hover { color: var(--km-red) !important; }
.km-section-links__count { flex: none; min-width: 32px; padding: 2px 8px; border-radius: 999px; background: #f3f4f6; color: var(--km-muted); font-size: 13px; text-align: center; }

/* ---------- Buttons ---------- */
.km-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 20px;
    border: 0;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: filter .2s, transform .15s;
}
.km-btn:active { transform: scale(.98); }
.km-btn:hover { filter: brightness(.96); }
.km-btn:disabled { opacity: .6; cursor: default; }
.km-btn--primary { width: 100%; background: var(--km-red); color: #fff !important; box-shadow: 0 6px 16px rgba(216, 32, 40, .28); }
.km-btn--secondary { background: var(--km-soft); color: var(--km-ink) !important; }
.km-btn--ghost { background: transparent; color: var(--km-muted) !important; }
.km-btn--outline { border: 1px solid #d1d5db; background: #fff; color: var(--km-text) !important; font-weight: 500; }
.km-btn--block { width: 100%; }

.km-stepper { display: inline-flex; flex: none; align-items: center; gap: 4px; padding: 4px; border-radius: 14px; background: var(--km-soft); }
.km-stepper button {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
    color: var(--km-ink);
    cursor: pointer;
}
.km-stepper__qty { min-width: 28px; font-weight: 750; text-align: center; }

/* ---------- My Order ---------- */
.km-order-list { margin: 0; padding: 0; list-style: none; }
.km-order-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--km-line); }
.km-order-item__thumb { flex: none; width: 52px; height: 52px; overflow: hidden; border-radius: 10px; background: var(--km-photo-bg); }
.km-order-item__thumb img { width: 100%; height: 100%; object-fit: cover; }
.km-order-item__thumb .km-nophoto { font-size: 18px; }
.km-order-item__info { flex: 1; min-width: 0; }
.km-order-item__name { display: -webkit-box; overflow: hidden; font-size: 13.5px; font-weight: 700; line-height: 1.3; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.km-order-item__sub { margin-top: 2px; color: var(--km-muted); font-size: 12.5px; }
.km-order-item .km-stepper button { width: 32px; height: 32px; }
.km-order-summary { display: flex; align-items: center; justify-content: space-between; padding: 16px 0 8px; font-size: 15px; }
.km-order-summary strong { color: var(--km-navy); font-size: 21px; }
.km-order-empty { margin: 0; padding: 28px 0; color: var(--km-muted); text-align: center; }

.km-member-cart { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--km-line); font-size: 14px; }
.km-member-cart h3 { margin: 0 0 8px; color: var(--km-ink); font-size: 16px; }
.km-member-cart .cart-item { margin: 0; padding: 0; list-style: none; }
.km-member-cart .cart-item li { position: relative; display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--km-line); }
.km-member-cart .thumb img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; }
.km-member-cart .cart-delete { position: absolute; top: 8px; right: 0; }
.km-member-cart input { width: 56px; padding: 4px 6px; border: 1px solid var(--km-line); border-radius: 8px; }

/* ---------- Info sheet ---------- */
.km-info { text-align: center; }
.km-info .km-sheet__title { padding: 0 44px; }
.km-info__logo { width: 168px; margin: 8px auto 10px; padding: 12px 14px; overflow: hidden; border-radius: 20px; background: #fff; box-shadow: var(--km-shadow); }
.km-info__logo img { width: 100%; height: auto; }
.km-info__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 18px 0 12px; }

/* ---------- Branches sheet (the map button) ---------- */
.km-branches { margin: 12px 0 0; padding: 0; list-style: none; }
.km-branch { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--km-line); }
.km-branch:last-child { border-bottom: 0; }
.km-branch__icon {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(216, 32, 40, .1);
    color: var(--km-red);
    font-size: 18px;
}
.km-branch__info { flex: 1; min-width: 0; }
.km-branch__name { margin: 0; color: var(--km-text); font-size: 16px; font-weight: 600; line-height: 1.3; }
.km-branch__address { margin: 4px 0 0; color: var(--km-muted); font-size: 14px; line-height: 1.45; }
.km-branch [lang="km"] { line-height: 1.7; }
.km-branch__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.km-btn--sm { min-height: 38px; padding: 0 14px; border-radius: 12px; font-size: 14px; }

/* ---------- Floating "My Order" button ---------- */
.km-fab {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}
.km-fab__circle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--km-red);
    box-shadow: 0 8px 22px rgba(216, 32, 40, .4);
    color: #fff;
    font-size: 22px;
}
.km-fab__count {
    position: absolute;
    top: -3px;
    right: -3px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
    color: var(--km-ink);
    font-size: 12px;
    font-weight: 800;
}
.km-fab__label { padding: 1px 8px; border-radius: 999px; background: rgba(255, 255, 255, .92); color: var(--km-red); font-size: 11.5px; font-weight: 750; }
.km-fab.is-bump .km-fab__circle { animation: km-bump .4s; }

/* ---------- Back-to-top button: shows once the page is scrolled down, above "My Order" when that shows ---------- */
.km-body .km-totop {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 45;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 6px 18px rgba(12, 14, 38, .3);
    color: var(--km-ink);
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity .2s, transform .2s, visibility .2s;
}
.km-body .km-totop.is-visible { opacity: 1; visibility: visible; transform: none; }
.km-body .km-totop:active { transform: scale(.93); }
.km-body .km-totop:focus-visible { outline: 3px solid var(--km-red); outline-offset: 3px; }
.km-body .km-fab:not([hidden]) ~ .km-totop { right: 21px; bottom: calc(112px + env(safe-area-inset-bottom)); }
@keyframes km-bump { 50% { transform: scale(1.15); } }

/* ---------- Toast and loading ---------- */
.km-toast {
    position: fixed;
    left: 50%;
    top: calc(14px + env(safe-area-inset-top));
    z-index: 200;
    padding: 10px 18px;
    border-radius: 999px;
    background: #fff;
    color: var(--km-ink);
    font-size: 14px;
    font-weight: 650;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(12, 14, 38, .25);
    transform: translate(-50%, -16px);
    transition: opacity .2s, transform .2s;
}
.km-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.km-loading { display: flex; justify-content: center; padding: 72px 0; }
.km-spinner { width: 32px; height: 32px; border: 3px solid #e7e4ef; border-top-color: var(--km-red); border-radius: 50%; animation: km-spin .8s linear infinite; }
@keyframes km-spin { to { transform: rotate(360deg); } }

/* ---------- Photo loading: a shimmer fills the photo box until the photo arrives (js/menu.js marks it is-loaded), then it fades in ---------- */
.km-item__thumb img, .km-cat img, .km-dish__photo img, .km-order-item__thumb img {
    background: var(--km-photo-bg) linear-gradient(100deg, rgba(255, 255, 255, 0) 35%, rgba(255, 255, 255, .75) 50%, rgba(255, 255, 255, 0) 65%) no-repeat;
    background-size: 200% 100%;
    animation: km-shimmer 1.4s linear infinite;
}
.km-item__thumb img.is-loaded, .km-cat img.is-loaded, .km-dish__photo img.is-loaded, .km-order-item__thumb img.is-loaded { background: none; animation: km-fade-in .4s ease-out; }
/* Dish sheet: the list thumbnail, blurred, waits under the big photo */
.km-dish__photo { position: relative; }
.km-dish__photo img { position: relative; }
.km-dish__photo .km-dish__preview { position: absolute; top: 0; left: 0; filter: blur(10px); transform: scale(1.08); }
.km-dish__preview + .km-dish__full:not(.is-loaded) { background: none; color: transparent; animation: none; }
@keyframes km-shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
@keyframes km-fade-in { from { opacity: 0; } }

/* ---------- Time is up (views/expired.php): a card asking the guest to scan the table QR code again ---------- */
body.km-expired-page { display: flex; align-items: center; justify-content: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.km-expired {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 380px;
    padding: 28px 24px;
    border-radius: var(--km-radius);
    background: var(--km-card);
    box-shadow: var(--km-shadow);
    text-align: center;
}
.km-expired__logo { width: 160px; height: auto; margin-bottom: 20px; }
.km-expired__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    border-radius: 50%;
    background: var(--km-soft);
    color: var(--km-red);
    font-size: 34px;
}
.km-expired__title { margin: 0 0 8px; color: var(--km-ink); font-size: 21px; font-weight: 750; line-height: 1.3; }
.km-expired__text { margin: 0; color: var(--km-muted); }
.km-expired .km-lang { margin-top: 24px; background: var(--km-soft); }

/* ---------- Larger screens ---------- */
@media (min-width: 640px) {
    .km-hero { padding: 16px; border-radius: 24px; }
    .km-hero__tagline { font-size: 22px; }
    .km-logo { flex-basis: 184px; }
    .km-iconbtn { width: 40px; height: 40px; }
    .km-section--cats { padding: 24px 32px 8px; }
    .km-fav { padding: 8px 32px 0; }
    .km-fav__track { gap: 16px; }
    .km-fav__slide { flex-basis: calc((100% - 16px) / 2); }
    .km-fav__card { height: 240px; }
    .km-cat-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
    .km-cat { height: 160px; }
    .km-cat__name { font-size: 24px; }
    .km-sheet { align-items: center; padding: 24px; }
    .km-sheet__panel { border-radius: 24px; opacity: 0; transform: translateY(24px) scale(.98); transition: transform .25s, opacity .25s; }
    .km-sheet.is-open .km-sheet__panel { opacity: 1; transform: none; }
    .km-sheet__handle { display: none; }
}
@media (min-width: 640px) {
    .km-menu { padding: 0 24px; }
    .km-menu__title { padding: 40px 0 28px; font-size: 36px; text-align: center; }
}
@media (min-width: 768px) {
    .km-list { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
    .km-item { padding: 8px; }
    .km-dish { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .km-dish__photo { aspect-ratio: auto; height: 100%; min-height: 380px; }
    .km-badge--media { top: 0; bottom: auto; border-radius: 0 16px 0 12px; }
    .km-dish__content { padding: 16px; }
    .km-dish__head { padding-right: 44px; }
    .km-dish__name { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
    .km-sheet, .km-sheet__panel, .km-sheet__overlay, .km-cat, .km-cat img, .km-item, .km-btn, .km-toast, .km-totop, .km-fav__card, .km-fav__dot::before { transition: none !important; }
    .km-fab.is-bump .km-fab__circle, .km-spinner { animation: none; }
    .km-item__thumb img, .km-cat img, .km-dish__photo img, .km-order-item__thumb img { animation: none !important; }
    /* The background is left out on purpose: it keeps moving even with Windows "Animation effects" off (laptops often
       have that off), because the owner wants it seen everywhere. To stop it, set MENU_BG_ANIMATION to false in config.php. */
}
