/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

html, body {
    height: 100%;
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: #F0F4E8;
    color: #2D3A1E;
    overflow: hidden;
}

/* === PAGES === */
.page {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    flex-direction: column;
}

.page.active {
    display: flex;
}

/* Home page: scrollable content */
#page-home {
    overflow-y: auto;
    overflow-x: hidden;
}

/* ===================================
   HOME — ALL ORIENTATIONS
   =================================== */
.home-header {
    text-align: center;
    padding: clamp(16px, 3vh, 50px) clamp(16px, 2vw, 30px) clamp(10px, 1.5vh, 24px);
}

.home-header h1 {
    font-size: clamp(24px, 5vmin, 64px);
    color: #3A5F0B;
    margin-bottom: clamp(4px, 0.5vh, 10px);
}

.subtitle {
    font-size: clamp(14px, 2.5vmin, 28px);
    color: #6B8F3C;
}

/* === CAROUSEL === */
.carousel-wrapper {
    min-height: clamp(350px, 55vh, 700px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: clamp(8px, 1.5vh, 20px) 0;
}

.carousel {
    display: flex;
    width: 100%;
    gap: clamp(20px, 3vw, 48px);
    padding: 0 clamp(24px, 3.5vw, 80px);
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.carousel::-webkit-scrollbar {
    display: none;
}

/* === CARD === */
.card {
    flex: 0 0 clamp(260px, 28vw, 420px);
    height: clamp(300px, 50vh, 580px);
    background: #fff;
    border-radius: clamp(20px, 3vmin, 36px);
    box-shadow: 0 8px 40px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    scroll-snap-align: center;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.card-img {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.card-emoji {
    font-size: clamp(48px, 10vmin, 140px);
    line-height: 1;
}

.card-body {
    padding: clamp(12px, 2vmin, 28px) clamp(14px, 2.5vmin, 32px);
    text-align: center;
    flex-shrink: 0;
}

.card-body h2 {
    font-size: clamp(16px, 2.5vmin, 34px);
    margin-bottom: clamp(2px, 0.5vmin, 8px);
    color: #2D3A1E;
    line-height: 1.2;
    /* Ensure text doesn't get cut off */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.card-price {
    font-size: clamp(14px, 2vmin, 26px);
    color: #6B8F3C;
    font-weight: 600;
}

/* === CART FAB === */
.cart-fab {
    position: fixed;
    bottom: clamp(16px, 3vmin, 48px);
    right: clamp(16px, 3vmin, 48px);
    background: #3A5F0B;
    color: #fff;
    font-size: clamp(18px, 2.8vmin, 32px);
    padding: clamp(10px, 1.8vmin, 22px) clamp(16px, 2.8vmin, 36px);
    border-radius: 50px;
    box-shadow: 0 6px 24px rgba(58,95,11,0.4);
    cursor: pointer;
    transition: transform 0.2s;
    z-index: 100;
    display: none;
}

.cart-fab.visible {
    display: flex;
    align-items: center;
    gap: clamp(4px, 0.8vmin, 8px);
}

.cart-fab:active {
    transform: scale(0.92);
}

#cart-count {
    background: #FF6B35;
    color: #fff;
    border-radius: 50%;
    width: clamp(24px, 3.5vmin, 42px);
    height: clamp(24px, 3.5vmin, 42px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(13px, 2vmin, 22px);
    font-weight: 700;
}

/* === QUEST PAGE === */
#page-quest, #page-cart {
    overflow: hidden;
}

.quest-header {
    display: flex;
    align-items: center;
    gap: clamp(12px, 2vmin, 20px);
    padding: clamp(16px, 2.5vmin, 30px) clamp(20px, 3vmin, 40px) clamp(12px, 2vmin, 20px);
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    flex-shrink: 0;
}

.btn-back {
    background: none;
    border: 2px solid #3A5F0B;
    color: #3A5F0B;
    font-size: clamp(16px, 2.2vmin, 24px);
    padding: clamp(8px, 1.2vmin, 12px) clamp(16px, 2.5vmin, 28px);
    border-radius: clamp(10px, 1.5vmin, 16px);
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-back:active {
    background: #3A5F0B;
    color: #fff;
}

.quest-content {
    flex: 1;
    overflow-y: auto;
    padding: clamp(16px, 3vmin, 40px);
    -webkit-overflow-scrolling: touch;
}

.quest-banner {
    width: 100%;
    height: clamp(150px, 30vh, 400px);
    border-radius: clamp(14px, 2vmin, 24px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: clamp(16px, 2.5vmin, 32px);
}

.quest-banner-emoji {
    font-size: clamp(80px, 14vmin, 180px);
}

.quest-content h1 {
    font-size: clamp(26px, 4vmin, 52px);
    color: #3A5F0B;
    margin-bottom: clamp(8px, 1.5vmin, 16px);
}

.quest-content .quest-meta {
    display: flex;
    gap: clamp(10px, 1.8vmin, 24px);
    margin-bottom: clamp(12px, 2vmin, 24px);
    flex-wrap: wrap;
}

.quest-meta-item {
    background: #E8F0D8;
    padding: clamp(6px, 1vmin, 14px) clamp(12px, 2vmin, 28px);
    border-radius: clamp(8px, 1.2vmin, 14px);
    font-size: clamp(13px, 2vmin, 22px);
    color: #3A5F0B;
    font-weight: 500;
}

.quest-content .quest-desc {
    font-size: clamp(16px, 2.4vmin, 26px);
    line-height: 1.7;
    color: #4A5D34;
    margin-bottom: clamp(16px, 2.5vmin, 32px);
}

.quest-content .quest-includes h3 {
    font-size: clamp(18px, 2.8vmin, 32px);
    color: #3A5F0B;
    margin-bottom: clamp(8px, 1.5vmin, 16px);
}

.quest-content .quest-includes ul {
    list-style: none;
    padding: 0;
}

.quest-content .quest-includes li {
    font-size: clamp(14px, 2.2vmin, 24px);
    padding: clamp(4px, 0.8vmin, 12px) 0;
    color: #4A5D34;
}

.quest-content .quest-includes li::before {
    content: "\2705 ";
}

.quest-actions {
    padding: clamp(12px, 2vmin, 24px) clamp(20px, 3vmin, 40px);
    background: #fff;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
    flex-shrink: 0;
}

.btn-cart {
    width: 100%;
    padding: clamp(12px, 2vmin, 26px);
    font-size: clamp(18px, 2.8vmin, 32px);
    background: #3A5F0B;
    color: #fff;
    border: none;
    border-radius: clamp(12px, 1.8vmin, 20px);
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-cart:active {
    background: #2D4A08;
}

/* === CART PAGE === */
.cart-title {
    font-size: clamp(24px, 3.5vmin, 40px);
    color: #3A5F0B;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: clamp(12px, 2vmin, 24px) clamp(20px, 3vmin, 40px);
}

.cart-item {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: clamp(12px, 1.8vmin, 20px);
    padding: clamp(12px, 2vmin, 20px) clamp(16px, 2.5vmin, 28px);
    margin-bottom: clamp(8px, 1.5vmin, 16px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.cart-item-emoji {
    font-size: clamp(30px, 5vmin, 52px);
    margin-right: clamp(12px, 2vmin, 20px);
}

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

.cart-item-info h3 {
    font-size: clamp(18px, 2.8vmin, 30px);
    color: #2D3A1E;
    margin-bottom: clamp(2px, 0.4vmin, 4px);
}

.cart-item-info p {
    font-size: clamp(14px, 2.2vmin, 24px);
    color: #6B8F3C;
    font-weight: 600;
}

.cart-item-remove {
    background: none;
    border: none;
    font-size: clamp(22px, 3.2vmin, 36px);
    cursor: pointer;
    padding: clamp(4px, 0.8vmin, 8px);
    color: #c0392b;
}

.cart-empty {
    text-align: center;
    padding: clamp(40px, 8vmin, 80px) clamp(12px, 2vmin, 20px);
    font-size: clamp(18px, 2.8vmin, 30px);
    color: #999;
}

.cart-footer {
    padding: clamp(12px, 2vmin, 24px) clamp(20px, 3vmin, 40px);
    background: #fff;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: clamp(12px, 2vmin, 24px);
    flex-shrink: 0;
}

.cart-total {
    font-size: clamp(22px, 3.2vmin, 36px);
    font-weight: 700;
    color: #2D3A1E;
    flex: 1;
}

.btn-pay {
    padding: clamp(12px, 2vmin, 24px) clamp(28px, 4vmin, 56px);
    font-size: clamp(18px, 2.6vmin, 30px);
    background: #FF6B35;
    color: #fff;
    border: none;
    border-radius: clamp(12px, 1.8vmin, 20px);
    cursor: pointer;
    font-weight: 700;
    transition: background 0.2s;
}

.btn-pay:active {
    background: #E55A25;
}

/* === MODAL === */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: clamp(18px, 3vmin, 32px);
    padding: clamp(32px, 5vmin, 60px) clamp(36px, 6vmin, 80px);
    text-align: center;
    max-width: min(520px, 80vw);
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-emoji {
    font-size: clamp(48px, 8vmin, 80px);
    margin-bottom: clamp(12px, 2vmin, 20px);
}

.modal h2 {
    font-size: clamp(24px, 3.5vmin, 40px);
    color: #2D3A1E;
    margin-bottom: clamp(8px, 1.2vmin, 12px);
}

.modal p {
    font-size: clamp(16px, 2.2vmin, 24px);
    color: #888;
    margin-bottom: clamp(16px, 3vmin, 32px);
}

.btn-close-modal {
    padding: clamp(10px, 1.5vmin, 16px) clamp(28px, 4vmin, 48px);
    font-size: clamp(16px, 2.2vmin, 22px);
    background: #3A5F0B;
    color: #fff;
    border: none;
    border-radius: clamp(10px, 1.5vmin, 16px);
    cursor: pointer;
    font-weight: 600;
}

.btn-close-modal:active {
    background: #2D4A08;
}

/* ===================================
   PORTRAIT — вертикальная ориентация
   Для 43" вертикальных киосков
   =================================== */
@media (orientation: portrait) {
    .carousel {
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
        scroll-snap-type: y mandatory;
        align-items: center;
        gap: clamp(24px, 2.5vh, 48px);
    }

    .card {
        flex: 0 0 auto;
        width: min(88%, 620px);
        height: clamp(320px, 22vh, 520px);
        border-radius: clamp(24px, 3vmin, 40px);
    }

    .card-emoji {
        font-size: clamp(56px, 8vmin, 160px);
    }

    .card-body h2 {
        font-size: clamp(18px, 2.2vmin, 38px);
    }

    .card-price {
        font-size: clamp(16px, 1.8vmin, 28px);
    }
}

/* ===================================
   LARGE DISPLAYS (>40") — bigger text
   =================================== */
@media (min-width: 2000px), (min-height: 2000px) {
    .home-header h1 {
        font-size: clamp(32px, 4vmin, 80px);
    }

    .subtitle {
        font-size: clamp(18px, 2vmin, 34px);
    }

    .card-body h2 {
        font-size: clamp(20px, 2vmin, 40px);
    }

    .card-price {
        font-size: clamp(16px, 1.8vmin, 32px);
    }
}

/* ===================================
   CONTENT SECTIONS (hero, about, custom)
   =================================== */
.hero-section {
    display: flex;
    align-items: center;
    gap: clamp(16px, 3vw, 40px);
    padding: clamp(16px, 3vh, 40px) clamp(20px, 3vw, 60px);
    background: linear-gradient(135deg, #E8F0D8 0%, #F0F4E8 100%);
    margin: 0 clamp(12px, 2vw, 20px) clamp(12px, 2vh, 16px);
    border-radius: clamp(14px, 2vmin, 24px);
}

.hero-content {
    flex: 1;
}

.hero-content h2 {
    font-size: clamp(22px, 3.5vmin, 40px);
    color: #3A5F0B;
    margin-bottom: clamp(6px, 1vh, 12px);
}

.hero-content p {
    font-size: clamp(14px, 2.2vmin, 22px);
    color: #4A5D34;
    line-height: 1.6;
}

.hero-section img {
    max-width: clamp(120px, 20vw, 300px);
    max-height: clamp(120px, 20vh, 300px);
    border-radius: clamp(10px, 1.5vmin, 20px);
    object-fit: cover;
}

.about-section {
    text-align: center;
    padding: clamp(20px, 3vh, 40px) clamp(20px, 3vw, 60px);
    margin: 0 clamp(12px, 2vw, 20px) clamp(12px, 2vh, 16px);
    background: #fff;
    border-radius: clamp(14px, 2vmin, 24px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}

.about-section h2 {
    font-size: clamp(22px, 3.5vmin, 40px);
    color: #3A5F0B;
    margin-bottom: clamp(6px, 1vh, 12px);
}

.about-section p {
    font-size: clamp(14px, 2.2vmin, 22px);
    color: #4A5D34;
    line-height: 1.7;
    max-width: 700px;
    margin: 0 auto;
}

.custom-section {
    padding: clamp(16px, 2.5vh, 32px) clamp(20px, 3vw, 60px);
    margin: 0 clamp(12px, 2vw, 20px) clamp(12px, 2vh, 16px);
    background: #fff;
    border-radius: clamp(14px, 2vmin, 24px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}

.custom-section h2 {
    font-size: clamp(20px, 3vmin, 34px);
    color: #3A5F0B;
    margin-bottom: clamp(4px, 0.8vh, 10px);
}

.custom-section p {
    font-size: clamp(13px, 2vmin, 20px);
    color: #4A5D34;
    line-height: 1.6;
    margin-bottom: clamp(4px, 0.8vh, 8px);
}

.custom-section .address {
    color: #6B8F3C;
    font-weight: 500;
}

.custom-img {
    max-width: 100%;
    max-height: clamp(150px, 25vh, 400px);
    border-radius: clamp(10px, 1.5vmin, 16px);
    margin-top: clamp(8px, 1.5vh, 16px);
    object-fit: cover;
}
