/* =============================================
   СТИЛИ СТРАНИЦ ИГР — подключается на genshin/hsr/wuwa/zzz
   ============================================= */

/* Кнопка «Перейти к оплате» в момент создания платежа: остаётся яркой,
   показывает вращающийся спиннер, повторные клики игнорируются (checkoutBusy) */
.checkout-btn.btn-loading:disabled {
    background: linear-gradient(90deg, #ff4dff, #b300b3);
    color: #fff; opacity: 0.9; cursor: wait;
    box-shadow: 0 5px 15px rgba(255, 77, 255, 0.3);
}
.checkout-btn.btn-loading::after {
    content: ''; display: inline-block; width: 15px; height: 15px;
    margin-left: 10px; vertical-align: -2px; border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, 0.35); border-top-color: #fff;
    animation: btn-spin 0.7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* На тач-экранах тап «залипает» в :hover — карточка прыгала и оставалась приподнятой.
   Двойной класс = выше специфичность, перебивает и inline-стили страниц. */
@media (hover: none) {
    .product-card.product-card:hover { transform: none; border-color: #3a2b4d; box-shadow: none; }
    .product-card.product-card:hover .buy-btn:not(.active-btn) { background: transparent; }
    .product-card:active { transform: scale(0.985); transition: transform 0.1s; }
}
/* Подсветка лейбла «Срочный заказ» только там, где есть настоящий hover
   (инлайновый onmouseover на iOS требовал двойной тап по галочке) */
@media (hover: hover) {
    .urgent-label:hover { border-color: #ff7eb3 !important; }
}

/* --- Плавающая кнопка корзины --- */
#cart-float-btn {
    position: fixed; bottom: 24px; right: 24px; z-index: 950;
    width: 70px; height: 70px; border-radius: 50%;
    background: linear-gradient(135deg, #ff4dff, #b300b3);
    box-shadow: 0 4px 22px rgba(255, 77, 255, 0.5);
    display: none; flex-direction: column; align-items: center; justify-content: center;
    cursor: pointer; color: #fff; font-weight: bold; text-align: center; line-height: 1.2;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid rgba(255,255,255,0.15);
}
#cart-float-btn:hover { transform: scale(1.12); box-shadow: 0 6px 28px rgba(255, 77, 255, 0.7); }
#cart-float-btn:active { transform: scale(0.96); }
#cart-float-btn .cfb-icon { font-size: 22px; line-height: 1; }
#cart-float-btn .cfb-sum { font-size: 11px; margin-top: 2px; opacity: 0.95; }
@media (max-width: 950px) {
    #cart-float-btn { bottom: 16px; right: 16px; width: 62px; height: 62px; }
}

main {
    max-width: 1200px; margin: 0 auto; padding: 40px 20px;
    position: relative; z-index: 5;
    display: flex; align-items: flex-start; gap: 30px;
}
.content-left { flex: 1; min-width: 0; }
.cart-right {
    width: 350px; position: sticky; top: 100px;
    background: rgba(30, 25, 38, 0.94); border: 1px solid #ff7eb3;
    border-radius: 20px; padding: 25px;
    box-shadow: 0 0 30px rgba(255, 126, 179, 0.15);
    /* blur убран: на sticky-элементе пересчитывался при каждом скролле (FPS) */
    max-height: calc(100vh - 120px); overflow-y: auto; box-sizing: border-box;
}
.cart-right::-webkit-scrollbar { width: 4px; }
.cart-right::-webkit-scrollbar-thumb { background: #ff7eb3; border-radius: 5px; }
@media (max-width: 950px) {
    main { flex-direction: column; }
    .cart-right { width: 100%; position: static; max-height: none; order: -1; margin-bottom: 20px; }
}

/* --- Шапка игры --- */
.game-header {
    display: flex; align-items: center; gap: 20px; margin-bottom: 30px;
    background: rgba(30, 25, 38, 0.6); padding: 20px;
    border-radius: 20px; border: 1px solid #3a2b4d;
}
.game-header img { width: 90px; height: 90px; border-radius: 20px; object-fit: cover; box-shadow: 0 0 20px rgba(255, 126, 179, 0.2); }
.game-header h1 { margin: 0; font-size: 32px; background: linear-gradient(90deg, #fff, #ff7eb3); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* --- Переключатель метода --- */
.method-switch {
    position: relative; display: flex;
    background: rgba(20, 15, 25, 0.8); border-radius: 15px; padding: 5px;
    margin-bottom: 30px; border: 1px solid #3a2b4d;
}
.method-switch-slider {
    position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc(50% - 5px);
    background: linear-gradient(90deg, #ff4dff, #b300b3);
    border-radius: 10px; transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 1; box-shadow: 0 0 15px rgba(255, 126, 179, 0.5);
}
.method-switch.uid-active .method-switch-slider { transform: translateX(100%); }
.method-btn {
    flex: 1; padding: 15px; text-align: center;
    background: transparent; border: none; color: #d8c3e0;
    font-size: 16px; font-weight: bold; cursor: pointer;
    z-index: 2; transition: color 0.3s;
}
.method-btn.active { color: white; }

/* --- Сетка товаров --- */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; margin-bottom: 40px; }
.product-card {
    position: relative;
    background: linear-gradient(145deg, #1e1926, #15111c);
    border: 1px solid #3a2b4d; border-radius: 20px; padding: 20px;
    display: flex; flex-direction: column; justify-content: space-between; align-items: center;
    text-align: center; transition: all 0.3s; cursor: pointer;
    box-sizing: border-box; height: 100%;
}
/* Скидка */
.discount-badge {
    position: absolute; top: 10px; right: 10px;
    background: linear-gradient(135deg, #ff4dff, #b300b3);
    color: #fff; font-size: 12px; font-weight: 800;
    padding: 3px 9px; border-radius: 20px;
    box-shadow: 0 0 12px rgba(255, 77, 255, 0.5);
    z-index: 3; letter-spacing: 0.3px;
}
.old-price {
    color: #a097b0; text-decoration: line-through;
    font-size: 14px; margin-right: 6px; font-weight: 600;
}
.product-card:hover { transform: translateY(-5px); border-color: #ff7eb3; box-shadow: 0 10px 20px rgba(255, 126, 179, 0.3); }
.product-icon { font-size: 45px; margin-bottom: 10px; filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.2)); }
.product-name { font-weight: bold; font-size: 14px; color: #ffffff; margin-bottom: 15px; line-height: 1.3; }
.gem-prefix { width: 18px; height: 18px; object-fit: contain; vertical-align: -4px; margin-right: 3px; }
.product-info-bottom { width: 100%; display: flex; flex-direction: column; align-items: center; }
.product-price { font-size: 20px; font-weight: bold; color: #ff7eb3; margin-bottom: 15px; text-shadow: 0 0 10px rgba(255, 126, 179, 0.4); }

/* --- Кнопки карточки --- */
.card-controls { display: flex; gap: 8px; width: 100%; }
.minus-btn {
    width: 44px; background: transparent; border: 1px solid #ff7eb3; color: #ff7eb3;
    border-radius: 12px; font-weight: bold; font-size: 24px; cursor: pointer;
    transition: 0.3s; display: none; align-items: center; justify-content: center; padding: 0;
}
.minus-btn:hover { background: #ff7eb3; color: white; box-shadow: 0 0 15px rgba(255, 126, 179, 0.4); }
.buy-btn {
    flex: 1; padding: 10px; background: transparent;
    border: 1px solid #ff7eb3; color: #ff7eb3;
    border-radius: 10px; font-weight: bold; cursor: pointer; transition: 0.3s;
}
.product-card:hover .buy-btn:not(.active-btn) { background: rgba(255, 126, 179, 0.2); }
.buy-btn.active-btn { background: #ff7eb3 !important; color: white !important; box-shadow: 0 0 15px rgba(255, 126, 179, 0.4); }
.buy-btn.active-btn:hover { background: #ff4dff !important; }

/* --- Корзина --- */
.checkout-step { display: none; animation: fadeIn 0.3s ease; }
.checkout-step.active { display: block; }
.back-step-btn {
    background: transparent; border: none; color: #d8c3e0;
    font-size: 14px; font-weight: bold; cursor: pointer;
    padding: 0; margin-bottom: 15px;
    display: flex; align-items: center; gap: 5px; transition: 0.3s;
}
.back-step-btn:hover { color: #ff7eb3; }

.cart-header { font-size: 22px; font-weight: bold; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; transition: all 0.3s; }
.cart-header.catch-bounce { animation: catchPulse 0.3s ease-out; }
@keyframes catchPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); color: #ff7eb3; text-shadow: 0 0 15px rgba(255, 126, 179, 1); }
    100% { transform: scale(1); }
}

.cart-items { max-height: 350px; overflow-y: auto; margin-bottom: 20px; padding-right: 5px; }
.cart-item {
    background: #120f18; border: 1px solid #3a2b4d; border-radius: 12px;
    padding: 12px; margin-bottom: 10px;
    display: flex; justify-content: space-between; align-items: center;
}
.cart-item-info { flex: 1; margin-right: 10px; }
.cart-item-name { font-size: 13px; font-weight: bold; margin-bottom: 5px; line-height: 1.2; }
.cart-item-price { color: #ff7eb3; font-size: 14px; font-weight: bold; }
.cart-item-controls { display: flex; align-items: center; gap: 8px; background: rgba(30, 25, 38, 0.8); padding: 5px; border-radius: 8px; }
.qty-btn { background: transparent; border: none; color: white; font-size: 16px; cursor: pointer; padding: 0 5px; }
.qty-btn:hover { color: #ff7eb3; }
.qty-text { font-size: 14px; font-weight: bold; width: 15px; text-align: center; }

.cart-summary { border-top: 1px solid #3a2b4d; padding-top: 15px; margin-bottom: 20px; }
.total-row { display: flex; justify-content: space-between; font-size: 20px; font-weight: bold; color: white; margin-bottom: 10px; }
.total-amount { color: #ff7eb3; text-shadow: 0 0 10px rgba(255, 126, 179, 0.5); }
.checkout-btn {
    width: 100%; padding: 15px;
    background: linear-gradient(90deg, #ff4dff, #b300b3);
    color: white; border: none; border-radius: 12px;
    font-size: 18px; font-weight: bold; cursor: pointer; transition: 0.3s;
    box-shadow: 0 5px 15px rgba(255, 77, 255, 0.3);
}
.checkout-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(255, 77, 255, 0.5); }
.checkout-btn:disabled { background: #4a3b5d; color: #a097b0; cursor: not-allowed; box-shadow: none; transform: none; }

/* --- Форма оформления --- */
.section-label { font-size: 16px; margin-top: 10px; margin-bottom: 10px; color: #ff7eb3; font-weight: bold; }
.input-group { background: rgba(30, 25, 38, 0.6); padding: 15px; border-radius: 15px; border: 1px solid #3a2b4d; margin-bottom: 15px; }
.input-row { display: flex; flex-direction: column; gap: 10px; }
/* Группировка товаров по категориям (сворачиваемые секции) */
.products-grid.grouped { display: block !important; }
.cat-block { margin-bottom: 22px; }
.cat-title {
    font-size: 18px; font-weight: bold; color: #ff7eb3; margin: 0 0 14px;
    padding: 10px 14px; border: 1px solid #3a2b4d; border-radius: 12px;
    background: rgba(30, 25, 38, 0.55); display: flex; align-items: center;
    justify-content: space-between; gap: 8px; cursor: pointer;
    transition: border-color 0.2s, background 0.2s, margin 0.35s ease; user-select: none;
}
.cat-title:hover { border-color: #ff7eb3; background: rgba(255, 126, 179, 0.08); }
.cat-count { font-size: 12px; color: #a097b0; font-weight: normal; background: rgba(255,255,255,0.06); padding: 1px 8px; border-radius: 10px; margin-left: 4px; }
.cat-arrow { color: #ff7eb3; font-size: 16px; transition: transform 0.35s ease; }
.cat-block.collapsed .cat-arrow { transform: rotate(-90deg); }
.cat-block.collapsed .cat-title { margin-bottom: 0; }

/* Плавное сворачивание аккордеона (если используется) */
.prod-wrap { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.35s ease; }
.cat-block.collapsed .prod-wrap { grid-template-rows: 0fr; }
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.prod-wrap .prod-grid { overflow: hidden; min-height: 0; }

/* Каскадное появление карточек (только opacity — чтобы не конфликтовать с hover) */
@keyframes cardIn { from { opacity: 0; } to { opacity: 1; } }
.prod-grid .product-card { animation: cardIn 0.4s ease both; }
.prod-grid .product-card:nth-child(1) { animation-delay: 0s; }
.prod-grid .product-card:nth-child(2) { animation-delay: .04s; }
.prod-grid .product-card:nth-child(3) { animation-delay: .08s; }
.prod-grid .product-card:nth-child(4) { animation-delay: .12s; }
.prod-grid .product-card:nth-child(5) { animation-delay: .16s; }
.prod-grid .product-card:nth-child(6) { animation-delay: .20s; }
.prod-grid .product-card:nth-child(7) { animation-delay: .24s; }
.prod-grid .product-card:nth-child(8) { animation-delay: .28s; }
.prod-grid .product-card:nth-child(n+9) { animation-delay: .32s; }
body.low-end-mode .prod-grid .product-card { animation: none; }

/* Фильтр-вкладки категорий */
.cat-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.cat-tab { padding: 9px 16px; border-radius: 30px; border: 1px solid #3a2b4d; background: rgba(30,25,38,0.55); color: #d8c3e0; font-weight: bold; font-size: 13px; cursor: pointer; transition: 0.2s; display: inline-flex; align-items: center; gap: 6px; }
.cat-tab:hover { border-color: #ff7eb3; color: #fff; }
.cat-tab.active { background: linear-gradient(90deg,#ff4dff,#b300b3); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(179,0,179,0.3); }
.cat-tab.active .cat-count { background: rgba(255,255,255,0.18); color: #fff; }
#prod-grid-main { transition: opacity 0.18s ease; }

/* --- Поиск по товарам --- */
.prod-search {
    width: 100%; box-sizing: border-box;
    background: rgba(20, 15, 25, 0.8); border: 1px solid #3a2b4d; border-radius: 12px;
    color: #fff; padding: 11px 16px; font-size: 14px; font-family: inherit;
    margin-bottom: 14px; outline: none; transition: border-color 0.2s;
}
.prod-search:focus { border-color: #ff7eb3; }
.prod-search::placeholder { color: #7c7090; }

/* --- Мобилка: 2 товара в строке, компактные карточки --- */
@media (max-width: 600px) {
    .products-grid, .prod-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .product-card { padding: 12px 10px; border-radius: 16px; }
    .product-icon { font-size: 34px; margin-bottom: 6px; }
    .product-icon img { max-width: 64px; max-height: 64px; }
    .product-name { font-size: 12px; margin-bottom: 10px; }
    .product-price { font-size: 16px; margin-bottom: 10px; }
    .old-price { font-size: 12px; }
    .buy-btn { padding: 8px 4px; font-size: 12px; }
    .minus-btn { width: 36px; font-size: 20px; }
}
.cat-tab-locked { opacity: 0.75; }
.cat-count.cat-locked { background: rgba(255,77,77,0.18); color: #ffb3b3; font-size: 10px; }
.cat-unavailable { grid-column: 1 / -1; padding: 26px 18px; text-align: center; background: rgba(255,255,255,0.03); border: 1px dashed #4a3b5d; border-radius: 14px; color: #a097b0; font-size: 14px; line-height: 1.7; }
.cat-unavailable b { color: #ff7eb3; }

.input-field { display: flex; flex-direction: column; gap: 6px; }
.input-field label { color: #d8c3e0; font-weight: bold; font-size: 12px; }
.input-field input,
.input-field select {
    padding: 12px 14px; background: #1c1626; border: 1.5px solid #4a3b5d;
    border-radius: 10px; color: #fff; -webkit-text-fill-color: #fff; font-size: 14px; outline: none;
    transition: 0.25s; width: 100%; box-sizing: border-box;
}
.input-field input::placeholder { color: #565064; -webkit-text-fill-color: #565064; opacity: 1; font-style: italic; }
.input-field input:hover,
.input-field select:hover { border-color: #6a5b7d; background: #221a2e; }
.input-field input:focus,
.input-field select:focus {
    border-color: #ff7eb3; background: #221a2e;
    box-shadow: 0 0 0 3px rgba(255, 126, 179, 0.18), 0 0 14px rgba(255, 126, 179, 0.2);
}

/* Фикс белого фона при автозаполнении Chrome/Edge — держим тёмную тему */
.input-field input:-webkit-autofill,
.input-field input:-webkit-autofill:hover,
.input-field input:-webkit-autofill:focus,
.input-field input:-webkit-autofill:active {
    -webkit-text-fill-color: #ffffff;
    -webkit-box-shadow: 0 0 0 1000px #1c1626 inset;
    box-shadow: 0 0 0 1000px #1c1626 inset;
    caret-color: #ffffff;
    transition: background-color 99999s ease-in-out 0s;
}

.contact-switch {
    position: relative; display: flex;
    background: rgba(20, 15, 25, 0.8); border-radius: 10px; padding: 4px;
    margin-bottom: 10px; border: 1px solid #3a2b4d;
}
.contact-switch-slider {
    position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
    background: #4a3b5d; border-radius: 6px; transition: transform 0.3s; z-index: 1;
}
.contact-switch.vk-active .contact-switch-slider { transform: translateX(100%); }
.contact-btn { flex: 1; padding: 6px 0; background: transparent; border: none; color: #d8c3e0; font-size: 12px; cursor: pointer; z-index: 2; transition: 0.3s; position: relative; }
.contact-btn.active { color: white; font-weight: bold; }

.warning-text { font-size: 11px; margin-top: 5px; line-height: 1.3; color: #ff4d4d; }
.flying-cart-petal {
    position: fixed; width: 25px; height: 25px;
    background: linear-gradient(135deg, #ffb7d5 0%, #ff7eb3 100%);
    border-radius: 50% 0 50% 50%;
    pointer-events: none; z-index: 9999;
    box-shadow: 0 0 15px rgba(255, 126, 179, 0.9);
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.5s ease-in;
}
.form-container { display: none; opacity: 0; }
.form-container.active { display: block; opacity: 1; }

/* ============================================================
   ✨ ПРЕМИУМ-ПОЛИРОВКА карточек товаров
   ============================================================ */
/* Градиентная рамка (розовеет на hover) + глянцевый шайн */
.product-card {
    overflow: hidden;
    border: 1px solid transparent;
    background:
        linear-gradient(145deg, #1e1926, #15111c) padding-box,
        linear-gradient(145deg, #3a2b4d, #2a2036) border-box;
}
.product-card:hover {
    background:
        linear-gradient(145deg, #1e1926, #15111c) padding-box,
        linear-gradient(145deg, #ff7eb3, #b300b3) border-box;
}
.product-card::after {
    content: ''; position: absolute; top: 0; left: 0; width: 55%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.07), transparent);
    transform: translateX(-170%) skewX(-14deg); pointer-events: none; z-index: 1;
}
@media (hover: hover) {
    .product-card:hover::after { transition: transform 0.75s ease; transform: translateX(280%) skewX(-14deg); }
}
/* Пульс свечением при добавлении в корзину */
@keyframes cartPulse {
    0%   { box-shadow: 0 10px 20px rgba(255, 126, 179, 0.3); }
    40%  { box-shadow: 0 0 26px 6px rgba(255, 126, 179, 0.75); }
    100% { box-shadow: 0 10px 20px rgba(255, 126, 179, 0.3); }
}
.product-card.cart-pulse { animation: cartPulse 0.55s ease-out; }
