*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overscroll-behavior: none;
}

:root {
    --bg: #0a0a0a;
    --bg-elevated: #141414;
    --card-bg: #181818;
    --card-bg-hover: #1f1f1f;
    --text: #f5f5f7;
    --text-secondary: #86868b;
    --accent: #f5c518;
    --accent-glow: rgba(245, 197, 24, 0.15);
    --accent-gradient: linear-gradient(135deg, #f5c518 0%, #f0a000 100%);
    --border: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.12);
    --header-bg: rgba(14, 14, 14, 0.8);
    --pill-bg: rgba(255, 255, 255, 0.06);
    --pill-hover: rgba(255, 255, 255, 0.1);
    --pill-active-bg: var(--accent);
    --pill-active-text: #000;
    --price-color: #f5c518;
    --eur-color: #86868b;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 24px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
}

/* ===== Header ===== */
/* Banner: non-sticky top section — scrolls away naturally and only
   reappears when the user scrolls all the way back to the top. */
.header-banner {
    background: var(--header-bg);
    padding: 12px 16px 0;
}

/* Sticky controls: only search-bar + category tabs.
   Hide on scroll-down, slide back in on scroll-up. */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--header-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px 0;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

header.header-hidden {
    transform: translateY(-100%);
}

.header-top {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 14px;
}

.lang-select {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm, 6px);
    padding: 5px 22px 5px 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path fill='%23ccc' d='M1 3l4 4 4-4z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 6px center;
    transition: border-color 0.15s, background-color 0.15s;
}

.lang-select:hover,
.lang-select:focus {
    border-color: var(--accent, #f5c518);
    outline: none;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

/* ===== Intro Box ===== */
.intro-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.intro-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent-glow) 0%, transparent 60%);
    pointer-events: none;
}

.intro-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
    position: relative;
}

.intro-img {
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
    border: 2px solid var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
    position: relative;
}

/* ===== Signup Button ===== */
.signup-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    margin-bottom: 12px;
    background: var(--accent-gradient);
    color: #000;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.2px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 12px rgba(245, 197, 24, 0.25);
}

.signup-link:active {
    transform: scale(0.97);
    box-shadow: 0 1px 6px rgba(245, 197, 24, 0.2);
}

.signup-logo {
    height: 22px;
    object-fit: contain;
}

/* ===== Social Stack (Telegram / YouTube) ===== */
.social-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: #fff;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.social-link:active {
    transform: scale(0.97);
}

.social-logo {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.youtube-link {
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
    box-shadow: 0 2px 8px rgba(255, 0, 0, 0.25);
}

.telegram-link {
    background: linear-gradient(135deg, #2AABEE 0%, #229ED9 100%);
    box-shadow: 0 2px 8px rgba(42, 171, 238, 0.25);
}

/* ===== Search ===== */
.search-bar {
    position: relative;
    margin-bottom: 12px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    opacity: 0.6;
}

#search-input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    outline: none;
    -webkit-appearance: none;
    transition: all 0.2s ease;
}

#search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

#search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--card-bg);
}

#price-sort {
    padding: 10px 32px 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    color: var(--text);
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    white-space: nowrap;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: all 0.2s ease;
}

#price-sort:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

#price-sort option {
    background: var(--card-bg);
    color: var(--text);
}

/* ===== Category Tabs ===== */
.category-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 12px;
    -ms-overflow-style: none;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.category-pill {
    flex-shrink: 0;
    padding: 7px 16px;
    border: 1px solid var(--border);
    border-radius: 100px;
    background: var(--pill-bg);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.category-pill.active {
    background: var(--pill-active-bg);
    color: var(--pill-active-text);
    border-color: var(--accent);
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(245, 197, 24, 0.2);
}

.category-pill:active {
    transform: scale(0.93);
}

/* Discount Items pill — red flame + highlight */
.category-pill[data-category="Discount Items"] {
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.22) 0%, rgba(255, 59, 48, 0.08) 100%);
    border-color: #ff3b30;
    color: #ff5a4d;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(255, 59, 48, 0.25);
}

.category-pill[data-category="Discount Items"].active {
    background: linear-gradient(135deg, #ff3b30 0%, #d92b21 100%);
    color: #fff;
    border-color: #ff3b30;
}

/* Best Sellers pill — blue star + highlight */
.category-pill[data-category="Best Sellers"] {
    background: linear-gradient(135deg, rgba(64, 156, 255, 0.20) 0%, rgba(64, 156, 255, 0.08) 100%);
    border-color: #409cff;
    color: #5fb0ff;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(64, 156, 255, 0.22);
}

.category-pill[data-category="Best Sellers"].active {
    background: linear-gradient(135deg, #409cff 0%, #1e7bd6 100%);
    color: #fff;
    border-color: #409cff;
}

/* Budget Finds pill — green star + highlight */
.category-pill[data-category="Budget Finds"] {
    background: linear-gradient(135deg, rgba(48, 209, 88, 0.18) 0%, rgba(48, 209, 88, 0.08) 100%);
    border-color: #30d158;
    color: #30d158;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(48, 209, 88, 0.2);
}

.category-pill[data-category="Budget Finds"]::before {
    content: '★ ';
    color: #30d158;
}

.category-pill[data-category="Budget Finds"].active {
    background: linear-gradient(135deg, #30d158 0%, #28a745 100%);
    color: #000;
    border-color: #30d158;
}

.category-pill[data-category="Budget Finds"].active::before {
    color: #000;
}

/* ===== Main Content ===== */
main {
    padding: 16px;
    max-width: 800px;
    margin: 0 auto;
}

/* ===== Product Grid ===== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* ===== Product Card ===== */
.product-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
    border: 1px solid var(--border);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.product-card:active {
    transform: scale(0.97);
    border-color: var(--border-light);
}

@media (hover: hover) {
    .product-card:hover {
        border-color: rgba(245, 197, 24, 0.3);
        box-shadow: 0 4px 20px rgba(245, 197, 24, 0.08);
        background: var(--card-bg-hover);
    }
}

/* Discount Items cards — red ring, animated "Discount!" badge */
.product-card.discount {
    position: relative;
    border: 1.5px solid #ff3b30;
    box-shadow:
        0 0 0 1px rgba(255, 59, 48, 0.3),
        0 4px 22px rgba(255, 59, 48, 0.22);
    background: linear-gradient(180deg, rgba(255, 59, 48, 0.09) 0%, var(--card-bg) 60%);
}

.product-card.discount .product-price {
    color: #ff5a4d;
    font-weight: 700;
}

.discount-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 3;
    padding: 3px 9px;
    background: linear-gradient(135deg, #ff3b30 0%, #d92b21 100%);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.55);
    transform: rotate(-4deg);
    pointer-events: none;
    animation: discount-pulse 1.8s ease-in-out infinite;
}

@keyframes discount-pulse {
    0%, 100% { transform: rotate(-4deg) scale(1); }
    50%      { transform: rotate(-4deg) scale(1.08); }
}

@media (hover: hover) {
    .product-card.discount:hover {
        border-color: #ff3b30;
        box-shadow:
            0 0 0 1px rgba(255, 59, 48, 0.5),
            0 6px 28px rgba(255, 59, 48, 0.32);
    }
}

/* Best Sellers cards — blue ring + ★ badge */
.product-card.bestseller {
    position: relative;
    border: 1.5px solid #409cff;
    box-shadow:
        0 0 0 1px rgba(64, 156, 255, 0.25),
        0 4px 20px rgba(64, 156, 255, 0.18);
    background: linear-gradient(180deg, rgba(64, 156, 255, 0.07) 0%, var(--card-bg) 60%);
}

.product-card.bestseller::before {
    content: '★';
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #409cff 0%, #1e7bd6 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

.product-card.bestseller .product-price {
    color: #5fb0ff;
}

@media (hover: hover) {
    .product-card.bestseller:hover {
        border-color: #409cff;
        box-shadow:
            0 0 0 1px rgba(64, 156, 255, 0.45),
            0 6px 26px rgba(64, 156, 255, 0.28);
    }
}

/* Budget Finds cards — green ring, gradient green star badge */
.product-card.budget {
    position: relative;
    border: 1.5px solid #30d158;
    box-shadow:
        0 0 0 1px rgba(48, 209, 88, 0.25),
        0 4px 20px rgba(48, 209, 88, 0.18);
    background: linear-gradient(180deg, rgba(48, 209, 88, 0.06) 0%, var(--card-bg) 60%);
}

.product-card.budget::before {
    content: '★';
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #30d158 0%, #28a745 100%);
    color: #000;
    font-size: 12px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

.product-card.budget .product-price {
    color: #30d158;
}

@media (hover: hover) {
    .product-card.budget:hover {
        border-color: #30d158;
        box-shadow:
            0 0 0 1px rgba(48, 209, 88, 0.45),
            0 6px 26px rgba(48, 209, 88, 0.28);
    }
}

.product-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--bg);
    display: block;
}

.product-info {
    padding: 10px 12px 12px;
}

.product-name {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
    color: var(--text);
    letter-spacing: -0.1px;
}

.product-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--price-color);
    letter-spacing: -0.2px;
}

/* ===== Loading ===== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.spinner {
    width: 28px;
    height: 28px;
    border: 2.5px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-bottom: 14px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Error ===== */
.error {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.error button {
    margin-top: 16px;
    padding: 10px 28px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent-gradient);
    color: #000;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(245, 197, 24, 0.2);
}

/* ===== No Results ===== */
.no-results {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.hidden {
    display: none !important;
}

/* ===== Tablet+ ===== */
@media (min-width: 600px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }

    main {
        padding: 20px;
    }

    .product-name {
        font-size: 14px;
    }
}

/* ===== Desktop ===== */
@media (min-width: 900px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===== Product Modal ===== */
.product-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.product-modal.hidden {
    display: none;
}

.product-modal.modal-closing {
    opacity: 0;
}

.product-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.product-modal-content {
    position: relative;
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    overflow: hidden;
    max-width: 400px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(0) scale(1);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg), 0 0 60px rgba(0, 0, 0, 0.5);
}

.product-modal.modal-closing .product-modal-content {
    transform: translateY(24px) scale(0.96);
}

@keyframes modalSlideUp {
    from { transform: translateY(30px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.product-modal:not(.modal-closing) .product-modal-content {
    animation: modalSlideUp 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.product-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.product-modal-close:active {
    transform: scale(0.9);
    background: rgba(0, 0, 0, 0.7);
}

.product-modal-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    background: var(--bg);
}

.product-modal-info {
    padding: 18px 18px 14px;
}

.product-modal-name {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -0.2px;
}

.product-modal-price {
    font-size: 20px;
    font-weight: 800;
    color: var(--price-color);
    letter-spacing: -0.3px;
}

.product-modal-buy {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 18px 10px;
    padding: 14px;
    background: var(--accent-gradient);
    color: #000;
    font-size: 16px;
    font-weight: 700;
    border-radius: var(--radius-md);
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 12px rgba(245, 197, 24, 0.25);
    letter-spacing: -0.2px;
}

.product-modal-buy:active {
    transform: scale(0.97);
    box-shadow: 0 1px 6px rgba(245, 197, 24, 0.2);
}

.modal-buy-logo {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.product-modal-qc {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 18px 18px;
    padding: 12px;
    background: rgba(245, 197, 24, 0.08);
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1.5px solid rgba(245, 197, 24, 0.25);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: -0.1px;
}

.product-modal-qc:active {
    transform: scale(0.97);
    background: rgba(245, 197, 24, 0.12);
}

/* ===== In-app Browser Overlay ===== */
.inapp-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.inapp-overlay.hidden {
    display: none;
}

.inapp-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 32px 24px;
    max-width: 340px;
    text-align: center;
    color: var(--text);
    box-shadow: var(--shadow-lg);
}

.inapp-card h2 {
    margin-bottom: 16px;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.inapp-card p {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.inapp-card p strong {
    color: var(--text);
}

.inapp-ok-btn {
    background: var(--accent-gradient);
    color: #000;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 48px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(245, 197, 24, 0.2);
}
