/* =============================================
   ОБЩИЕ СТИЛИ — подключается на всех страницах
   ============================================= */

/* Убираем синее выделение при клике на кнопки/карточки */
button, a, .game-card, .product-card, .menu-item, .header-btn,
.cart-item, .buy-btn, .minus-btn, .checkout-btn, .auth-btn-primary,
.auth-btn-danger, .ref-copy-btn, .profile-btn, .cat-tab {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* Текст во всех текстовых полях всегда белый (перебивает чёрный от автозаполнения) */
input[type="text"], input[type="email"], input[type="number"],
input[type="tel"], input[type="password"], input[type="search"], textarea {
    color: #fff;
    -webkit-text-fill-color: #fff;
}

/* Глобальный фикс: автозаполнение Chrome/Edge не красит поля в белый */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-text-fill-color: #ffffff;
    -webkit-box-shadow: 0 0 0 1000px #120f18 inset;
    box-shadow: 0 0 0 1000px #120f18 inset;
    caret-color: #ffffff;
    transition: background-color 99999s ease-in-out 0s;
}

/* === МОДАЛКА ВХОДА (Личный кабинет) === */
.auth-card { text-align: center; }
.auth-avatar {
    width: 74px; height: 74px; margin: 4px auto 0; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 30% 30%, #2a2036, #15101d);
    border: 2px solid #ff7eb3; box-shadow: 0 0 22px rgba(255,126,179,0.35);
}
.auth-avatar-on { border-color: #4dff88; box-shadow: 0 0 22px rgba(77,255,136,0.35); }

.auth-tabs {
    display: flex; gap: 6px; background: rgba(20,15,25,0.7);
    border: 1px solid #3a2b4d; border-radius: 12px; padding: 5px; margin-bottom: 18px;
}
.auth-tab {
    flex: 1; padding: 10px 0; border: none; border-radius: 8px; cursor: pointer;
    background: transparent; color: #a097b0; font-weight: bold; font-size: 13px; transition: 0.25s;
}
.auth-tab.active { background: linear-gradient(90deg,#ff4dff,#b300b3); color: #fff; box-shadow: 0 4px 14px rgba(179,0,179,0.3); }
.auth-tab:not(.active):hover { color: #fff; }

.auth-pane { animation: fadeIn 0.25s; }
.auth-label { display:block; text-align:left; color:#d8c3e0; font-size:12px; font-weight:bold; margin-bottom:6px; }
.auth-input {
    width: 100%; box-sizing: border-box; padding: 12px 14px; margin-bottom: 12px;
    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;
}
.auth-input::placeholder { color: #565064; -webkit-text-fill-color: #565064; opacity: 1; font-style: italic; }
.auth-input:focus { border-color: #ff7eb3; background:#221a2e; box-shadow: 0 0 0 3px rgba(255,126,179,0.18); }
.auth-code-input { text-align:center; letter-spacing: 6px; font-size: 20px; font-weight: bold; }

.auth-btn-primary {
    width: 100%; padding: 13px; border: none; border-radius: 10px; cursor: pointer;
    background: linear-gradient(90deg,#ff4dff,#b300b3); color: #fff; font-weight: bold; font-size: 15px;
    box-shadow: 0 6px 18px rgba(179,0,179,0.3); transition: 0.25s;
}
.auth-btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(179,0,179,0.45); }
.auth-btn-danger {
    width: 100%; padding: 12px; border-radius: 10px; cursor: pointer; font-weight: bold; font-size: 14px;
    background: transparent; border: 1.5px solid #ff4d4d; color: #ff4d4d; transition: 0.25s; margin-top: 10px;
}
.auth-btn-danger:hover { background: #ff4d4d; color: #fff; }

.auth-msg { font-size: 13px; margin-top: 10px; min-height: 18px; }
.auth-hint { color: #7c7090; font-size: 11px; margin-top: 14px; line-height: 1.5; }
.auth-privacy { color: #6a5f7a; font-size: 11px; margin-top: 18px; border-top: 1px solid #2a2336; padding-top: 14px; }
.auth-privacy a { color: #a097b0; }

/* Подсветка кнопки профиля при входе */
.profile-btn.logged-in { border-color: #4dff88 !important; box-shadow: 0 0 14px rgba(77,255,136,0.4); }

/* === Поле пароля: глазок === */
.pw-wrap { position: relative; width: 100%; }
.pw-eye {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; padding: 4px; color: #a097b0;
    display: flex; align-items: center; justify-content: center; transition: color 0.2s;
}
.pw-eye:hover { color: #ff7eb3; }
.pw-eye svg { width: 20px; height: 20px; }

/* === ГЛАВНАЯ: счётчики + как это работает === */
.stats-bar {
    display: flex; gap: 16px; max-width: 800px; margin: 50px auto 0; flex-wrap: wrap;
}
.stat-cell {
    flex: 1; min-width: 150px; background: linear-gradient(145deg, #1e1926, #15111c);
    border: 1px solid #3a2b4d; border-radius: 18px; padding: 22px 16px; text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3); transition: 0.3s;
}
.stat-cell:hover { border-color: #ff7eb3; transform: translateY(-4px); box-shadow: 0 8px 24px rgba(255,126,179,0.2); }
.stat-num { font-size: 32px; font-weight: bold; color: #ff7eb3; text-shadow: 0 0 14px rgba(255,126,179,0.4); }
.stat-lbl { color: #a097b0; font-size: 13px; margin-top: 6px; }

/* Отзывы из Telegram на главной (под счётчиком заказов) — фиолетовая карточка,
   свёрнута по умолчанию, разворачивается кнопкой */
.home-reviews { max-width: 720px; margin: 60px auto 0; text-align: center; }
.home-reviews-sub { color: #a097b0; font-size: 14px; margin: 10px 0 22px; }
.tg-reviews-card {
    position: relative;
    background: linear-gradient(145deg, #241b31, #15111c);
    border: 1px solid #4a3b5d; border-radius: 20px; padding: 14px 14px 58px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.35), 0 0 24px rgba(255, 126, 179, 0.07);
    transition: border-color 0.3s;
}
.tg-reviews-card:hover { border-color: #ff7eb3; }
#tg-reviews-home {
    min-height: 120px; border-radius: 12px; overflow: hidden;
    /* Плавный разворот/сворачивание (разовая анимация по клику — FPS не грузит) */
    transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
#tg-reviews-home.collapsed { max-height: 380px; }
#tg-reviews-home:not(.collapsed) { max-height: 70vh; overflow-y: auto; }
#tg-reviews-home:not(.collapsed)::-webkit-scrollbar { width: 4px; }
#tg-reviews-home:not(.collapsed)::-webkit-scrollbar-thumb { background: #ff7eb3; border-radius: 4px; }
#tg-reviews-home iframe { width: 100% !important; }
/* Карточки отзывов (рендерим сами из /api/reviews — работает без VPN) */
.rv-item {
    display: flex; gap: 12px; padding: 13px 14px; text-align: left;
    border-bottom: 1px solid rgba(74, 59, 93, 0.45);
}
.rv-item:last-child { border-bottom: none; }
.rv-ava {
    width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%;
    background: linear-gradient(135deg, #ff7eb3, #b300b3);
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; color: #fff; font-size: 17px;
    box-shadow: 0 0 10px rgba(255, 126, 179, 0.3);
}
.rv-body { min-width: 0; }
.rv-name { font-weight: bold; color: #ff9ec6; font-size: 14px; margin-bottom: 3px; }
.rv-text { color: #e8dff0; font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: break-word; }
.rv-date { color: #7c7090; font-size: 12px; margin-top: 5px; }
/* Затухание внизу свёрнутого блока — видно, что отзывов больше */
.tg-reviews-fade {
    position: absolute; left: 1px; right: 1px; bottom: 52px; height: 90px;
    background: linear-gradient(to bottom, transparent, #17121e 92%);
    pointer-events: none; border-radius: 0 0 12px 12px;
    transition: opacity 0.35s;
}
.tg-reviews-fade.hidden { opacity: 0; }
/* Ряд кнопок под отзывами: свернуть/развернуть + ссылка на пост */
.tg-reviews-actions {
    position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center;
    width: max-content; max-width: calc(100% - 28px);
}
.tg-reviews-toggle, .tg-reviews-link {
    padding: 9px 20px; border-radius: 20px; cursor: pointer;
    background: transparent; border: 1px solid #ff7eb3; color: #ff7eb3;
    font-weight: bold; font-size: 13px; transition: 0.25s; white-space: nowrap;
    text-decoration: none; display: inline-flex; align-items: center;
}
.tg-reviews-toggle:hover { background: rgba(255, 126, 179, 0.15); box-shadow: 0 0 14px rgba(255, 126, 179, 0.35); color: #fff; }
/* Ссылка на пост — акцентная (заполненная), чтобы выделялась */
.tg-reviews-link { background: linear-gradient(90deg, #ff4dff, #b300b3); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(179, 0, 179, 0.3); }
.tg-reviews-link:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(179, 0, 179, 0.5); }
.tg-reviews-link:active { transform: scale(0.96); }

.how-section { max-width: 1000px; margin: 70px auto 0; }
.how-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-top: 30px; }
.how-card {
    position: relative; background: linear-gradient(145deg, #1e1926, #15111c); border: 1px solid #3a2b4d;
    border-radius: 20px; padding: 30px 24px 24px; text-align: center; transition: 0.3s; overflow: hidden;
}
.how-card:hover { border-color: #ff7eb3; transform: translateY(-5px); box-shadow: 0 10px 24px rgba(255,126,179,0.2); }
.how-num {
    position: absolute; top: -14px; right: 2px; font-size: 150px; font-weight: bold;
    color: rgba(255,126,179,0.1); line-height: 1; pointer-events: none;
}
.how-ic { font-size: 44px; margin-bottom: 12px; filter: drop-shadow(0 0 10px rgba(255,126,179,0.3)); }
.how-card h3 { margin: 0 0 10px; font-size: 18px; color: #fff; }
.how-card p { margin: 0; color: #a097b0; font-size: 14px; line-height: 1.6; }

/* === Cookie-баннер === */
.cookie-banner {
    position: fixed; bottom: 16px; left: 50%;
    transform: translateX(-50%) translateY(180%);
    max-width: 680px; width: calc(100% - 28px);
    background: linear-gradient(145deg, #221a2e, #15101d);
    border: 1px solid #ff7eb3; border-radius: 14px;
    padding: 14px 18px; display: flex; align-items: center; gap: 14px;
    /* z-index ниже модалок (2000): баннер не перекрывает открытые окна */
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); z-index: 1900;
    opacity: 0; transition: transform 0.45s cubic-bezier(0.25,0.8,0.25,1), opacity 0.45s;
}
.cookie-banner.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.cookie-banner span { color: #d8c3e0; font-size: 13px; line-height: 1.5; }
.cookie-banner a { color: #ff7eb3; }
.cookie-banner button {
    flex-shrink: 0; background: linear-gradient(90deg,#ff4dff,#b300b3); color: #fff;
    border: none; padding: 10px 22px; border-radius: 10px; font-weight: bold; cursor: pointer; transition: 0.25s;
}
.cookie-banner button:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(179,0,179,0.4); }
@media (max-width: 560px) { .cookie-banner { flex-direction: column; text-align: center; } }

/* === ПРЕЛОАДЕР (заставка загрузки) === */
#preloader {
    position: fixed; inset: 0; z-index: 100000;
    background: radial-gradient(circle at 50% 40%, #1a1326, #0f0c14 70%);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
#preloader.hidden { opacity: 0; visibility: hidden; }
.preloader-logo {
    font-family: 'Marck Script', cursive; font-weight: bold; text-align: center; padding: 0 20px;
    font-size: clamp(34px, 8vw, 58px); line-height: 1.1;
    background: linear-gradient(90deg, #5a4b6d 0%, #5a4b6d 38%, #ff7eb3 48%, #ff4dff 54%, #5a4b6d 64%, #5a4b6d 100%);
    background-size: 250% 100%;
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
    animation: logoShine 2s linear infinite;
}
@keyframes logoShine { 0% { background-position: 150% 0; } 100% { background-position: -50% 0; } }
.preloader-bar { width: 180px; height: 4px; background: rgba(255,255,255,0.08); border-radius: 4px; overflow: hidden; }
.preloader-bar::after {
    content: ''; display: block; height: 100%; width: 40%; border-radius: 4px;
    background: linear-gradient(90deg, #ff7eb3, #ff4dff); box-shadow: 0 0 12px rgba(255,126,179,0.6);
    animation: barMove 1.1s ease-in-out infinite;
}
@keyframes barMove { 0% { transform: translateX(-110%); } 100% { transform: translateX(360%); } }
body.low-end-mode .preloader-logo, body.low-end-mode .preloader-bar::after { animation: none; }

/* === TOAST-уведомления === */
#toast-box { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 99998; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast {
    display: flex; align-items: center; gap: 10px;
    background: linear-gradient(145deg, #241c30, #181320); border: 1px solid #3a2b4d; border-left: 4px solid #ff7eb3;
    color: #fff; padding: 13px 18px; border-radius: 12px; font-size: 14px; line-height: 1.4;
    box-shadow: 0 8px 26px rgba(0,0,0,0.45); max-width: 92vw;
    opacity: 0; transform: translateY(20px); transition: opacity 0.35s, transform 0.35s cubic-bezier(.2,.8,.2,1);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-ic { font-size: 18px; flex-shrink: 0; }
.toast-msg { flex: 1; }
.toast-close { background: none; border: none; color: #a097b0; font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; flex-shrink: 0; transition: 0.2s; pointer-events: auto; }
.toast-close:hover { color: #fff; }
.toast { pointer-events: auto; }
.toast-success { border-left-color: #4dff88; }
.toast-error { border-left-color: #ff4d4d; }
.toast-info { border-left-color: #ff7eb3; }

/* === Красивые скроллбары === */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); }
::-webkit-scrollbar-thumb { background: linear-gradient(#ff7eb3, #b300b3); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #ff7eb3; }
* { scrollbar-width: thin; scrollbar-color: #ff7eb3 transparent; }

/* === КОНФЕТТИ === */
.confetti-piece {
    position: fixed; top: -14px; width: 9px; height: 14px; border-radius: 2px;
    z-index: 99999; pointer-events: none; opacity: 0.95;
    animation-name: confettiFall; animation-timing-function: linear; animation-fill-mode: forwards;
}
@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(106vh) rotate(720deg); opacity: 0.5; }
}

/* === ЧАСЫ РАБОТЫ === */
.sched-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 11px 14px; border: 1px solid #3a2b4d; border-radius: 10px; margin-bottom: 8px;
    background: rgba(20,15,25,0.5); font-size: 14px; color: #d8c3e0;
}
.sched-row b { color: #fff; }
.sched-row.today { border-color: #ff7eb3; background: rgba(255,126,179,0.1); box-shadow: 0 0 12px rgba(255,126,179,0.15); }
.sched-row.today b { color: #ff7eb3; }
.sched-today { font-size: 10px; background: #ff7eb3; color: #15101d; padding: 1px 7px; border-radius: 8px; margin-left: 6px; font-weight: bold; vertical-align: middle; }

/* === ГАЛОЧКА УСПЕХА (модалка заказа) === */
.success-check { width: 88px; height: 88px; margin: 4px auto 0; }
.success-check svg { width: 100%; height: 100%; }
.sc-circle { fill: rgba(77,255,136,0.08); stroke: #4dff88; stroke-width: 3; stroke-dasharray: 151; stroke-dashoffset: 151; }
.sc-tick { fill: none; stroke: #4dff88; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; }
.success-check.play .sc-circle { animation: scCircle 0.5s ease forwards; }
.success-check.play .sc-tick { animation: scTick 0.35s ease 0.42s forwards; }
@keyframes scCircle { to { stroke-dashoffset: 0; } }
@keyframes scTick { to { stroke-dashoffset: 0; } }

/* === КРАСИВЫЕ ЧЕКБОКСЫ (с анимацией галочки) === */
#consent-input, #remember-me, #use-balance-check {
    -webkit-appearance: none; appearance: none;
    width: 19px; height: 19px; border: 2px solid #4a3b5d; border-radius: 6px;
    background: #1c1626; cursor: pointer; position: relative; vertical-align: middle;
    transition: background 0.2s, border-color 0.2s; flex-shrink: 0;
}
#consent-input:hover, #remember-me:hover, #use-balance-check:hover { border-color: #ff7eb3; }
#consent-input:checked, #remember-me:checked, #use-balance-check:checked {
    background: linear-gradient(135deg, #ff7eb3, #ff4dff); border-color: transparent; animation: cbPop 0.28s ease;
}
#consent-input:checked::after, #remember-me:checked::after, #use-balance-check:checked::after {
    content: ''; position: absolute; left: 50%; top: 45%; width: 5px; height: 9px;
    border: solid #fff; border-width: 0 2.5px 2.5px 0;
    transform: translate(-50%, -55%) rotate(45deg) scale(0);
    animation: cbCheck 0.28s ease 0.03s forwards;
}
@keyframes cbPop { 50% { transform: scale(1.18); } }
@keyframes cbCheck {
    0% { transform: translate(-50%, -60%) rotate(45deg) scale(0); }
    60% { transform: translate(-50%, -52%) rotate(45deg) scale(1.2); }
    100% { transform: translate(-50%, -55%) rotate(45deg) scale(1); }
}

/* === УРОВЕНЬ КЛИЕНТА (статус) === */
.tier-box {
    background: linear-gradient(145deg, #221a2e, #15101d); border: 1px solid #4a3b5d;
    border-radius: 14px; padding: 14px 16px; margin-bottom: 14px;
}
.tier-badge { font-size: 16px; font-weight: bold; color: #fff; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tier-badge .tier-disc { color: #4dff88; font-size: 13px; margin-left: auto; }
.tier-progress { height: 8px; background: #15101d; border-radius: 6px; margin: 10px 0 8px; overflow: hidden; border: 1px solid #3a2b4d; }
.tier-progress-fill { height: 100%; width: 0; background: linear-gradient(90deg,#ff7eb3,#ff4dff); border-radius: 6px; transition: width 0.6s ease; box-shadow: 0 0 10px rgba(255,126,179,0.5); }
.tier-next { color: #a097b0; font-size: 11px; text-align: left; }
.tier-next b { color: #ff7eb3; }
#tier-discount-note { color: #ffd24d; margin-bottom: 6px; }

/* === РЕФЕРАЛЬНАЯ ПАНЕЛЬ (в кабинете) === */
.ref-panel {
    background: rgba(255,126,179,0.06); border: 1px solid #3a2b4d;
    border-radius: 14px; padding: 16px; margin-bottom: 18px;
}
.ref-stats { display: flex; gap: 10px; margin-bottom: 14px; }
.ref-stat {
    flex: 1; background: #15101d; border: 1px solid #3a2b4d; border-radius: 10px;
    padding: 10px; display: flex; flex-direction: column; align-items: center;
}
.ref-stat b { color: #ff7eb3; font-size: 22px; line-height: 1; }
.ref-stat small { color: #a097b0; font-size: 11px; margin-top: 4px; }
.ref-label { text-align: left; color: #d8c3e0; font-size: 12px; font-weight: bold; margin-bottom: 8px; }
.ref-link-row { display: flex; gap: 8px; }
.ref-link-row .auth-input { font-size: 12px; flex: 1; }
.ref-copy-btn {
    flex-shrink: 0; padding: 0 16px; border: none; border-radius: 10px; cursor: pointer;
    background: linear-gradient(90deg,#ff4dff,#b300b3); color: #fff; font-weight: bold; font-size: 13px;
    transition: 0.25s; white-space: nowrap;
}
.ref-copy-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(179,0,179,0.4); }

/* Реф-блок в оформлении заказа */
.ref-checkout-box {
    background: rgba(255,126,179,0.08); border: 1px solid #4a3b5d;
    border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: 13px;
}
.ref-checkout-box #ref-discount-note { color: #4dff88; margin-bottom: 6px; }
.ref-checkout-box label { display: flex; align-items: center; gap: 8px; cursor: pointer; color: #d8c3e0; }
.ref-checkout-box input[type="checkbox"] { accent-color: #ff7eb3; width: 16px; height: 16px; }
.ref-checkout-box b { color: #ff7eb3; }

/* --- Фон и тело --- */
body {
    animation: fadeIn 0.15s ease-out;
    margin: 0; padding: 0;
    width: 100%; height: 100%;
    /* clip вместо hidden: hidden на body ломает sticky-шапку в iOS Safari
       (шапка «уезжает» при скролле). clip режет так же, но не создаёт скролл-контейнер. */
    overflow-x: hidden;
    overflow-x: clip;
    font-family: 'Roboto', sans-serif;
    background: radial-gradient(circle at 50% 30%, #251636 0%, #0d0a14 70%, #000000 100%);
    background-attachment: fixed;
    color: #ffffff;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.fade-out { opacity: 0 !important; transition: opacity 0.15s ease-in-out; }

/* «Живой» фон — мягкие цветные пятна, медленно дышат */
body::before {
    content: '';
    position: fixed;
    inset: -20%;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 20% 25%, rgba(255, 126, 179, 0.12), transparent 42%),
        radial-gradient(circle at 82% 70%, rgba(150, 90, 220, 0.14), transparent 46%),
        radial-gradient(circle at 60% 15%, rgba(120, 160, 255, 0.08), transparent 40%);
    /* Анимация убрана: слой размером 140% экрана перерисовывался бесконечно и грел CPU */
}

/* --- Сакура --- */
#sakura-tree {
    position: fixed; top: -30px; left: -30px;
    width: 550px; height: 450px;
    background-image: url('static/sakura_tree.webp');
    background-size: contain; background-repeat: no-repeat; background-position: left top;
    z-index: 1; pointer-events: none;
    /* drop-shadow убран: фильтр на большой анимированной картинке пересчитывался каждый кадр */
    transform-origin: 15% 0;
    animation: sway 6s ease-in-out infinite;
}
@keyframes sway { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(1.2deg); } }
#sakura-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 15; overflow: hidden; }
/* Внешний слой — ровное падение вниз (постоянная скорость) */
.petal {
    position: absolute;
    top: 0;
    opacity: 0;
    will-change: transform, opacity;
    animation: petal-fall var(--fall-duration, 11s) linear forwards;
}
@keyframes petal-fall {
    0%   { transform: translateY(-8vh); opacity: 0; }
    6%   { opacity: 1; }
    94%  { opacity: 1; }
    100% { transform: translateY(112vh); opacity: 0; }
}
/* Внутренний слой — плавное покачивание и переворот (с замедлением на поворотах) */
.petal-inner {
    width: 100%;
    height: 100%;
    border-radius: 100% 0 100% 0;
    opacity: var(--petal-opacity, 0.85);
    will-change: transform;
    animation: petal-sway var(--sway-duration, 3s) ease-in-out infinite alternate;
}
@keyframes petal-sway {
    0%   { transform: translateX(calc(var(--sway, 25px) * -1)) rotateZ(-15deg) rotateY(0deg); }
    100% { transform: translateX(var(--sway, 25px)) rotateZ(35deg) rotateY(360deg); }
}

/* --- Шапка --- */
header {
    position: sticky; top: 0; z-index: 100;
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 40px;
    /* Без backdrop-filter: блюр на sticky-шапке пересчитывается каждый кадр скролла
       и роняет FPS на ПК без аппаратного ускорения */
    background: rgba(13, 10, 20, 0.94);
    border-bottom: 1px solid #3a2b4d;
}
.logo-container { display: flex; align-items: center; gap: 15px; }
.logo-link {
    font-family: 'Marck Script', cursive; font-size: 34px;
    color: #ffffff; text-decoration: none;
    text-shadow: 0 0 15px rgba(255, 119, 255, 0.8);
    transition: 0.3s; z-index: 25; margin-right: 10px;
}
.header-btn {
    background: transparent; border: 1px solid #ff7eb3; color: #ff7eb3;
    padding: 6px 14px; border-radius: 20px;
    font-weight: bold; font-size: 13px; cursor: pointer;
    transition: 0.3s; display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.header-btn:hover {
    background: rgba(255, 126, 179, 0.2);
    box-shadow: 0 0 15px rgba(255, 126, 179, 0.4);
    transform: translateY(-2px); color: #fff; border-color: #fff;
}
.header-right { display: flex; align-items: center; gap: 20px; }

/* --- Профиль --- */
.profile-wrapper { position: relative; }
.profile-btn {
    background: transparent; border: 2px solid #ff7eb3; border-radius: 50%;
    width: 45px; height: 45px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: 0.3s;
    box-shadow: 0 0 10px rgba(255, 126, 179, 0.2);
    overflow: hidden; padding: 0;
}
.profile-btn:hover { box-shadow: 0 0 15px rgba(255, 126, 179, 0.6); transform: scale(1.05); }
.profile-btn svg { width: 24px; height: 24px; stroke: #ff7eb3; transition: 0.3s; }
.profile-btn img { width: 100%; height: 100%; object-fit: cover; }
.profile-dropdown {
    position: absolute; top: 60px; right: 0; width: 260px;
    background: rgba(30, 25, 38, 0.95); border: 1px solid #ff7eb3;
    border-radius: 15px; padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    transform: translateY(-10px); opacity: 0; visibility: hidden;
    transition: 0.3s; z-index: 200; text-align: center;
}
.profile-dropdown.active { transform: translateY(0); opacity: 1; visibility: visible; }
.dropdown-title { font-size: 16px; font-weight: bold; margin-bottom: 15px; color: #fff; }
.dropdown-subtitle { font-size: 13px; color: #a097b0; margin-bottom: 20px; }

/* --- Бургер-меню --- */
.hamburger { display: flex; flex-direction: column; gap: 6px; cursor: pointer; padding: 5px; z-index: 1001; }
.hamburger span { width: 30px; height: 3px; background: #ff7eb3; border-radius: 3px; transition: 0.4s; }
.hamburger.active span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

/* --- Боковое меню --- */
.side-menu {
    position: fixed; top: 0; right: -380px;
    width: 330px; height: 100vh;
    /* blur убран: пересчитывался каждый кадр анимации выезда меню и ронял FPS */
    background: linear-gradient(160deg, rgba(32, 23, 45, 0.99), rgba(15, 11, 20, 0.99));
    border-left: 1px solid rgba(255, 126, 179, 0.4);
    box-shadow: -12px 0 45px rgba(0, 0, 0, 0.55);
    z-index: 1000;
    transition: right 0.45s cubic-bezier(0.25, 0.8, 0.25, 1);
    padding: 24px 20px; display: flex; flex-direction: column; box-sizing: border-box;
}
.side-menu.active { right: 0; }
.menu-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.65); z-index: 999;
    opacity: 0; visibility: hidden; transition: 0.3s;
}
.menu-overlay.active { opacity: 1; visibility: visible; }

/* Шапка меню */
.side-menu-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 22px; padding-bottom: 16px; border-bottom: 1px solid #3a2b4d;
}
.side-menu-title {
    font-family: 'Marck Script', cursive; font-size: 30px; color: #ff7eb3;
    text-shadow: 0 0 15px rgba(255, 126, 179, 0.5);
}
.side-menu-close {
    background: rgba(255, 126, 179, 0.1); border: 1px solid #3a2b4d; color: #ff7eb3;
    width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
    font-size: 15px; transition: 0.3s; display: flex; align-items: center; justify-content: center;
}
.side-menu-close:hover { background: #ff7eb3; color: #fff; transform: rotate(90deg); }

/* Пункты меню */
.side-menu-items { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.menu-item {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 14px; border-radius: 14px;
    background: rgba(255, 255, 255, 0.02); border: 1px solid #2c2238;
    cursor: pointer; text-decoration: none;
    transition: background 0.3s, border-color 0.3s, transform 0.35s, opacity 0.35s, box-shadow 0.3s;
    opacity: 0; transform: translateX(24px);
}
.side-menu.active .menu-item { opacity: 1; transform: translateX(0); }
.side-menu.active .menu-item:nth-child(1) { transition-delay: 0.10s; }
.side-menu.active .menu-item:nth-child(2) { transition-delay: 0.16s; }
.side-menu.active .menu-item:nth-child(3) { transition-delay: 0.22s; }
.side-menu.active .menu-item:nth-child(4) { transition-delay: 0.28s; }
/* Сбрасываем задержку при hover — иначе nth-child delay даёт «тупёж» подсветки */
.side-menu.active .menu-item:hover {
    transition-delay: 0s;
    transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.menu-item:hover {
    background: rgba(255, 126, 179, 0.12); border-color: #ff7eb3;
    transform: translateX(-4px); box-shadow: 0 4px 20px rgba(255, 126, 179, 0.15);
}
.menu-item-ic {
    width: 44px; height: 44px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 20px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 126, 179, 0.2), rgba(179, 0, 179, 0.2));
    border: 1px solid rgba(255, 126, 179, 0.3);
}
.menu-item-txt { display: flex; flex-direction: column; flex: 1; }
.menu-item-txt b { color: #fff; font-size: 15px; }
.menu-item-txt small { color: #a097b0; font-size: 11px; margin-top: 2px; }
.menu-item-arrow { color: #ff7eb3; font-size: 22px; font-weight: bold; transition: transform 0.3s; }
.menu-item:hover .menu-item-arrow { transform: translateX(4px); }

/* Кнопка Telegram внизу */
.side-menu-tg {
    margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 14px; border-radius: 14px;
    background: linear-gradient(90deg, #2b5278, #3a6a96); color: #fff;
    text-decoration: none; font-weight: bold; transition: 0.3s;
}
.side-menu-tg:hover { box-shadow: 0 0 20px rgba(43, 82, 120, 0.6); transform: translateY(-2px); }

/* --- Модалки --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(13, 10, 20, 0.85);
    z-index: 2000; display: flex; justify-content: center; align-items: center;
    opacity: 0; visibility: hidden; transition: 0.3s;
    padding: 14px; box-sizing: border-box; /* отступ, чтобы рамка модалки была видна на телефоне */
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.custom-modal {
    background: linear-gradient(145deg, #1e1926, #15111c);
    border: 1px solid #ff7eb3; border-radius: 20px; padding: 30px;
    max-width: 500px; width: 90%;
    box-shadow: 0 10px 40px rgba(255, 126, 179, 0.3);
    position: relative; transform: translateY(-20px); transition: 0.3s;
    /* Высокие модалки скроллятся внутри, а не обрезаются экраном */
    max-height: calc(100vh - 28px);
    max-height: calc(100dvh - 28px);
    overflow-y: auto;
    overscroll-behavior: contain; /* скролл модалки не прокручивает сайт под ней */
    -webkit-overflow-scrolling: touch;
}
.modal-overlay.active .custom-modal { transform: translateY(0); }
/* Крестик прилипает к верху при скролле модалки — всегда под рукой */
.close-modal-btn {
    position: sticky; top: 0; float: right; z-index: 5;
    margin: -16px -16px 0 8px;
    width: 38px; height: 38px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(30, 25, 38, 0.85); border: none; color: #a097b0;
    font-size: 26px; cursor: pointer; transition: 0.3s; line-height: 1;
}
.close-modal-btn:hover { color: #ff4d4d; background: rgba(255, 77, 77, 0.12); }
/* Фон не листается, пока открыта модалка (top ставит JS, чтобы не прыгал скролл) */
body.modal-open { position: fixed; left: 0; right: 0; width: 100%; }

/* --- Настройки (тоггл) --- */
.setting-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid #3a2b4d; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #3a2b4d; transition: .4s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #ff7eb3; }
input:checked + .slider:before { transform: translateX(20px); }

/* --- Режим слабого ПК --- */
body.no-tree #sakura-tree { display: none !important; }
body.no-petals #sakura-container { display: none !important; }
/* Кнопки выбора качества в настройках */
.fx-btn {
    flex: 1; min-width: 70px; padding: 8px 6px; border-radius: 10px;
    border: 1px solid #3a2b4d; background: transparent; color: #d8c3e0;
    font-size: 12px; font-weight: bold; cursor: pointer; transition: 0.2s;
}
.fx-btn:hover { border-color: #ff7eb3; }
.fx-btn.active { background: rgba(255, 126, 179, 0.15); border-color: #ff7eb3; color: #ff7eb3; }

/* ============================================================
   КАЧЕСТВО ЭФФЕКТОВ — три уровня (выбирается в настройках или авто по FPS)
   Средний (по умолчанию): без блюров и вечных анимаций фона — быстро и красиво.
   ============================================================ */

/* --- ✨ Максимум (body.fx-max): вся красота для мощных устройств --- */
body.fx-max::before { animation: bg-drift 20s ease-in-out infinite alternate; }
@keyframes bg-drift {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(3%, -3%) scale(1.12); }
}
body.fx-max #sakura-tree { filter: drop-shadow(0 8px 24px rgba(255, 126, 179, 0.25)) drop-shadow(0 4px 12px rgba(20, 10, 30, 0.7)); }
body.fx-max .petal-inner { filter: drop-shadow(0 2px 3px rgba(255, 126, 179, 0.3)); }
body.fx-max header { background: rgba(13, 10, 20, 0.8); backdrop-filter: blur(10px); }
body.fx-max .side-menu { backdrop-filter: blur(22px); background: linear-gradient(160deg, rgba(32, 23, 45, 0.97), rgba(15, 11, 20, 0.98)); }
body.fx-max .menu-overlay { backdrop-filter: blur(3px); }
body.fx-max .modal-overlay { backdrop-filter: blur(5px); background: rgba(13, 10, 20, 0.8); }
body.fx-max .cart-right { backdrop-filter: blur(10px); background: rgba(30, 25, 38, 0.8); }

/* --- 🔋 Эконом (body.low-end-mode): без тяжёлого, но тени и ховеры остаются --- */
body.low-end-mode * { backdrop-filter: none !important; }
body.low-end-mode #sakura-container { display: none; }   /* лепестки */
body.low-end-mode #sakura-tree { animation: none; }      /* дерево видно, но статично */
body.low-end-mode .hero-track { transition: none; }      /* карусель без скольжения */
body.low-end-mode .prod-grid .product-card { animation: none; }
body.low-end-mode .tier-progress-fill,
body.low-end-mode .hero-progress-bar { transition: none; }

/* --- Футер --- */
footer {
    margin-top: 100px; padding: 40px 20px;
    background: rgba(13, 10, 20, 0.8);
    border-top: 1px solid #3a2b4d;
    text-align: center; position: relative; z-index: 5;
}
.footer-logo { font-family: 'Marck Script', cursive; font-size: 28px; color: #ff7eb3; margin-bottom: 10px; }
.footer-text { color: #a097b0; font-size: 14px; max-width: 600px; margin: 0 auto 20px; line-height: 1.6; }
.footer-copy { color: #fff; font-size: 13px; font-weight: bold; }

/* --- Акции и новости (модалка) --- */
.promo-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.promo-card { position: relative; background: linear-gradient(145deg, #1e1926, #15111c); border: 1px solid #3a2b4d; border-radius: 16px; padding: 18px; overflow: hidden; transition: 0.3s; text-align: left; }
.promo-card:hover { border-color: #ff7eb3; box-shadow: 0 6px 18px rgba(255,126,179,0.18); }
.promo-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, #ff4dff, #b300b3); }
.promo-tag { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: 0.5px; padding: 3px 10px; border-radius: 20px; margin-bottom: 10px; }
.promo-tag.sale { background: rgba(255,126,179,0.15); color: #ff7eb3; border: 1px solid rgba(255,126,179,0.4); }
.promo-tag.hot { background: rgba(255,77,77,0.15); color: #ff6b6b; border: 1px solid rgba(255,77,77,0.4); }
.promo-tag.new { background: rgba(77,255,136,0.12); color: #4dff88; border: 1px solid rgba(77,255,136,0.4); }
.promo-icon { font-size: 26px; margin-bottom: 4px; }
.promo-card h3 { margin: 4px 0 6px; font-size: 16px; color: #fff; }
.promo-card p { margin: 0; font-size: 13px; color: #a097b0; line-height: 1.5; }

/* --- Отзывы (инжектятся из components.js) --- */
.review-card { background: rgba(30, 25, 38, 0.8); border: 1px solid #3a2b4d; border-radius: 15px; padding: 15px; margin-bottom: 15px; text-align: left; transition: 0.3s; }
.review-card:hover { border-color: #ff7eb3; transform: translateX(5px); }
.review-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.review-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #ff7eb3, #b300b3); display: flex; align-items: center; justify-content: center; font-weight: bold; color: white; font-size: 18px; box-shadow: 0 0 10px rgba(255, 126, 179, 0.4); }
.review-name { font-weight: bold; color: #fff; font-size: 14px; }
.review-date { color: #a097b0; font-size: 12px; }
.review-text { color: #d8c3e0; font-size: 14px; line-height: 1.4; }
.reviews-container { max-height: 400px; overflow-y: auto; padding-right: 10px; margin-bottom: 20px; }
.reviews-container::-webkit-scrollbar { width: 4px; }
.reviews-container::-webkit-scrollbar-thumb { background: #ff7eb3; border-radius: 4px; }

@media (max-width: 900px) { .logo-container .header-btn { display: none; } }

/* Safari (iOS) красит зону над адресной строкой фоном <html> — без этого она белая */
html { background: #14101d; }

/* --- Трекер статуса заказа (Оплата → Выполняется → Готово) --- */
.order-tracker { display: flex; align-items: center; margin-top: 12px; padding: 0 4px; }
.ot-step { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.ot-step small { color: #7c7090; font-size: 10px; white-space: nowrap; }
.ot-dot {
    width: 22px; height: 22px; border-radius: 50%; font-size: 11px; font-weight: bold;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.06); border: 1px solid #3a2b4d; color: #7c7090;
}
.ot-dot.ot-done { background: rgba(77, 255, 136, 0.15); border-color: #4dff88; color: #4dff88; }
.ot-dot.ot-fail { background: rgba(255, 77, 77, 0.15); border-color: #ff4d4d; color: #ff4d4d; }
.ot-line { flex: 1; height: 2px; background: #3a2b4d; margin: 0 6px 14px; border-radius: 2px; }

/* Заголовки не сливаются с деревом сакуры: мягкая тёмная тень
   (drop-shadow, а не text-shadow — корректно работает с градиентным текстом) */
.main-title, .section-title { filter: drop-shadow(0 2px 10px rgba(10, 6, 16, 0.9)); }

/* --- Мобилка --- */
@media (max-width: 768px) {
    /* Дерево меньше и полупрозрачнее — текст поверх него читается */
    #sakura-tree { width: 320px; height: 260px; opacity: 0.4; }

    /* Шапка тоньше и компактнее */
    header { padding: 7px 14px; }
    .logo-link { font-size: 22px; margin-right: 4px; }
    .profile-btn { width: 37px; height: 37px; border-width: 1.5px; }
    .profile-btn svg { width: 19px; height: 19px; }
    .hamburger { gap: 5px; }
    .hamburger span { width: 24px; height: 2.5px; }
    .hamburger.active span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
    .hamburger.active span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

    /* Модалки на телефоне: компактнее внутренние отступы, рамка видна по краям */
    .custom-modal { padding: 24px 16px 20px; width: 100% !important; }
    .close-modal-btn { margin: -12px -4px 0 8px; }
    .reviews-container { max-height: none; padding-right: 4px; }
}

/* ============================================================
   ✨ ПРЕМИУМ-ПОЛИРОВКА — визуальные улучшения
   Всё на transform/opacity + статичные слои: не грузит слабые ПК.
   ============================================================ */

/* --- Зерно + виньетка: убирают «полосатость» градиента, дают глубину --- */
/* mix-blend-mode НЕ используем: полноэкранное смешивание грузило компоновщик
   на анимациях (лаги). Обычная полупрозрачная текстура — статична и дешёва. */
#fx-grain {
    position: fixed; inset: 0; z-index: 40; pointer-events: none;
    opacity: 0.06;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body::after {
    content: ''; position: fixed; inset: 0; z-index: 41; pointer-events: none;
    background: radial-gradient(ellipse at 50% 38%, transparent 55%, rgba(8, 5, 14, 0.5) 100%);
}
/* Модалки и попапы — поверх виньетки/зерна, чтобы оставались чистыми */
.modal-overlay, .side-menu, .cookie-banner, #toast-box { z-index: 2000; }

/* Эконом/слабые ПК: премиум-слои и шайн выключаем — производительность важнее */
body.low-end-mode #fx-grain,
body.low-end-mode::after { display: none; }
body.low-end-mode .game-card::after,
body.low-end-mode .product-card::after,
body.low-end-mode .how-card::after { display: none; }

/* Уважаем системную настройку «уменьшить движение» */
@media (prefers-reduced-motion: reduce) {
    #fx-grain, body::after { display: none; }
    .game-card::after, .product-card::after, .how-card::after { display: none; }
    * { scroll-behavior: auto; }
}

/* (content-visibility убран: на планшете вызывал дёрганье липкой шапки при
   скролле — рефлоу от рендера/схлопывания секций. Прирост FPS дало снятие
   mix-blend у зерна, этого достаточно.) */

/* --- Разделители секций: тонкие линии по бокам заголовка --- */
.section-title::before, .section-title::after {
    content: ''; height: 1px; flex: 1 1 auto; max-width: 130px; align-self: center;
    background: linear-gradient(90deg, transparent, rgba(255, 126, 179, 0.55));
}
.section-title::after { background: linear-gradient(90deg, rgba(255, 126, 179, 0.55), transparent); }

/* --- Пружинное нажатие кнопок --- */
.header-btn:active, .buy-btn:active, .checkout-btn:active, .auth-btn-primary:active,
.auth-btn-danger:active, .ref-copy-btn:active, .fx-btn:active, .side-menu-tg:active,
.tg-reviews-toggle:active { transform: scale(0.96); }

/* --- «Как это работает»: градиентная рамка + шайн при наведении --- */
.how-card {
    border: 1px solid transparent;
    background:
        linear-gradient(145deg, #1e1926, #15111c) padding-box,
        linear-gradient(145deg, #3a2b4d, #2a2036) border-box;
}
.how-card:hover {
    background:
        linear-gradient(145deg, #1e1926, #15111c) padding-box,
        linear-gradient(145deg, #ff7eb3, #b300b3) border-box;
}
.how-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: 2;
}
@media (hover: hover) {
    .how-card:hover::after { transition: transform 0.75s ease; transform: translateX(280%) skewX(-14deg); }
}
