::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
    background: #7f1d1d;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #e11d22;
}

.card-hover {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-hover:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -5px rgba(225, 29, 34, 0.15);
}

#loader {
    position: fixed;
    inset: 0;
    background: #0f0f0f;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-out, visibility 0.5s;
}

.logo-watermark-gray {
    filter: grayscale(1) brightness(0.6);
    opacity: 0.7;
}

/* 3D Book Styles */
.book-wrapper {
    perspective: 2500px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
}

.book {
    position: relative;
    width: 300px;
    height: 440px;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-radius: 4px 12px 12px 4px;
}

.book.is-open {
    transform: rotateY(-10deg);
}

@media (min-width: 768px) {
    .book {
        width: 380px;
        height: 520px;
    }
}

.page {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    transform-origin: left center;
    transform-style: preserve-3d;
    transition: transform 1.35s cubic-bezier(.2, .85, .15, 1);
    border-radius: 4px 12px 12px 4px;
    cursor: pointer;
    background-color: #fff;
}

.front,
.back {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 4px 12px 12px 4px;
    overflow: hidden;
    background-color: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.front {
    z-index: 2;
    transform: rotateY(0deg);
    background-image: linear-gradient(to right, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0) 10%);
}

.back {
    transform: rotateY(180deg);
    z-index: 1;
    background-color: #fcfcfc;
    background-image: linear-gradient(to left, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0) 10%);
    border-left: 1px solid #ddd;
}

.page::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
    border-radius: 4px 12px 12px 4px;
    background: linear-gradient(to right, rgba(0, 0, 0, .35), rgba(0, 0, 0, 0) 35%);
    opacity: 0.35;
    transition: opacity 1.35s, background 1.35s;
}

.page.flipped {
    transform: rotateY(-180deg) translateZ(1px);
    box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.22);
}

.page:not(.flipped) {
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.22);
}

.page.flipped::after {
    opacity: 0.18;
    background: linear-gradient(to left, rgba(0, 0, 0, .30), rgba(0, 0, 0, 0) 35%);
}

.promo-card:hover {
    box-shadow: 0 0 25px rgba(250, 204, 21, 0.4);
    border-color: #facc15;
}

.lang-btn.active {
    border-color: #facc15;
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(250, 204, 21, 0.3);
}

a,
button {
    touch-action: manipulation;
}

/* --- Slider Styles (Improved for Mobile) --- */
#recommended-menu-grid>div {
    /* Mobile: 85% width ให้เห็นขอบรูปถัดไป (Peek effect) แก้ปัญหาดูเต็มจอเกินไป */
    flex: 0 0 85%;
    max-width: 85%;
    scroll-snap-align: start;
}

/* ปรับปรุงการแสดงผลรูปภาพ */
#recommended-menu-grid img {
    /* Mobile: เปลี่ยนเป็นแนวตั้ง (Portrait 3:4) เพื่อให้รูปเต็มกรอบสวยงามเหมือนในแอป */
    aspect-ratio: 3/4;
    object-fit: cover;
    width: 100%;
    height: auto;
    /* ปล่อยให้สูงตามสัดส่วน */
    border-radius: 8px;
    /* เพิ่มความโค้งมนเล็กน้อย */
    display: block;
}

/* FIX: แก้ปัญหาพื้นหลังข้อความ (TOP1, NEW) ยืดยาวเกินไป 
      บังคับให้ Elements ที่มีสีพื้นหลัง (เช่น bg-brand-gold) มีความกว้างเท่ากับเนื้อหาข้างในเท่านั้น 
    */
#recommended-menu-grid [class*="bg-brand-"] {
    width: -moz-fit-content;
    width: fit-content;
}

@media (min-width: 768px) {
    #recommended-menu-grid>div {
        flex: 0 0 calc((100% - 2rem) / 2);
        /* Tablet: 2 รูป */
        max-width: calc((100% - 2rem) / 2);
        border-radius: 4px;
    }

    /* Desktop: เอา Override ออกเพื่อให้ใช้ aspect-ratio: 3/4 เหมือนมือถือ */
    /* ทำให้รูปบนจอคอมแสดงผลเต็มกรอบแนวตั้งเหมือนกัน */
}

@media (min-width: 1024px) {
    #recommended-menu-grid>div {
        flex: 0 0 calc((100% - 3rem) / 3);
        /* PC: 3 รูป */
        max-width: calc((100% - 3rem) / 3);
        border-radius: 4px;
    }
}