/* === 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;
    touch-action: pan-y;
}

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

.page.active {
    display: flex;
}

/* ===================================
   HOME — LANDSCAPE (24"–42" horizontal)
   =================================== */
.home-header {
    text-align: center;
    padding: clamp(12px, 2vh, 40px) clamp(12px, 2vw, 20px) clamp(8px, 1.5vh, 20px);
}

.home-header h1 {
    font-size: clamp(28px, 4.5vmin, 52px);
    color: #3A5F0B;
    margin-bottom: clamp(4px, 0.5vh, 8px);
}

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

/* === CAROUSEL === */
.carousel-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: clamp(4px, 1vh, 16px) 0;
}

.carousel {
    display: flex;
    width: 100%;
    gap: clamp(16px, 2.5vw, 40px);
    padding: 0 clamp(20px, 3vw, 60px);
    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 29vw;
    height: clamp(320px, 68vh, 580px);
    background: #fff;
    border-radius: clamp(16px, 2.5vmin, 32px);
    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;
}

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

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

.card-body h2 {
    font-size: clamp(18px, 2.8vmin, 34px);
    margin-bottom: clamp(4px, 0.5vmin, 8px);
    color: #2D3A1E;
}

.card-price {
    font-size: clamp(14px, 2.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 === */
.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);
}

.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);
}

.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);
}

.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 — вертикальная ориентация
   Карусель переключается на вертикальный скролл
   =================================== */
@media (orientation: portrait) {
    .carousel {
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
        scroll-snap-type: y mandatory;
        align-items: center;
    }

    .card {
        flex: 0 0 auto;
        width: min(90%, 560px);
        height: clamp(280px, 28vh, 420px);
    }
}
