/* Базовые сбросы и настройки экрана под формат TikTok */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #343440; /* Умеренно серый фон вместо тёмного */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
    color: #fff;
    -webkit-tap-highlight-color: transparent;
}

/* Обновленная шапка платформы */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    box-sizing: border-box;
    z-index: 100;
}

.user-wallet {
    display: flex;
    align-items: center;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.user-wallet.bump {
    transform: scale(1.2);
}

/* Центральный контейнер для полосы опыта */
.xp-bar-container {
    flex-grow: 1;
    margin: 0 15px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

/* Заполнение полосы опыта — ЗОЛОТОЙ СТИЛЬ */
.xp-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ffd700, #ffa500, #ffec8b, #ffd700);
    background-size: 300% 100%;
    position: relative;
    border-radius: 10px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    animation: goldFlow 6s linear infinite;
}

/* Блик на золотой полосе */
.xp-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-25deg);
    animation: shine 3s infinite ease-in-out;
}

.xp-bar-text {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #fff;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

@keyframes goldFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
@keyframes shine {
    0% { left: -150%; }
    50% { left: 150%; }
    100% { left: 150%; }
}

.xp-bar-container.pulse {
    animation: barPulse 0.4s ease-out;
}
@keyframes barPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(255, 215, 0, 0); }
    50% { transform: scale(1.04); box-shadow: 0 0 15px rgba(255, 215, 0, 0.6); }
    100% { transform: scale(1); box-shadow: 0 0 0 rgba(255, 215, 0, 0); }
}

.profile-trigger {
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Лента полноэкранных игр */
.feed-container {
    width: 100%;
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    box-sizing: border-box;
    padding-top: 60px;
}
.feed-container.scroll-locked {
    overflow-y: hidden !important;
    touch-action: none !important;
}

/* Подложка под игры в ленте */
.game-slot {
    width: 100%;
    height: calc(100vh - 60px);
    scroll-snap-align: start;
    position: relative;
    background: #434352; /* Чуть светлее, чем основной body */
}

.game-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* =========================================================================
   НОВАЯ ГОРИЗОНТАЛЬНАЯ НИЖНЯЯ ПАНЕЛЬ УПРАВЛЕНИЯ
   ========================================================================= */

.bottom-ui-bar {
    position: absolute;
    bottom: 20px;          /* Отступ от самого низа экрана */
    left: 50%;
    transform: translateX(-50%); /* Центрируем всю панель */
    width: calc(100% - 40px); /* Растягиваем с безопасными отступами по бокам */
    max-width: 360px;      /* Ограничение ширины для планшетов и больших экранов */
    z-index: 10;
    
    display: flex;
    flex-direction: row;   /* Кнопки выстраиваются горизонтально в ряд */
    justify-content: space-between; /* Равномерно распределяем их по ширине */
    align-items: center;
    
    background: rgba(0, 0, 0, 0.4); /* Мягкая общая темная подложка для ряда */
    padding: 10px 15px;
    border-radius: 25px;   /* Округлый стильный корпус панели */
    backdrop-filter: blur(8px); /* Размытие игры под кнопками */
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-sizing: border-box;
}

/* Обновляем базовую кнопку под горизонтальный ряд */
.ui-btn {
    width: 48px;
    height: 48px;
    background: #1e1e24;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0 !important; /* Убираем любые конфликтующие отступы */
}

/* Сохраняем логику подсветки активного замка */
.bottom-ui-bar .lock-btn.active {
    background: #ff4757;
    border-color: #ff4757;
    transform: scale(1.08);
    box-shadow: 0 0 15px #ff4757;
}

.ui-btn:active {
    transform: scale(0.9);
}

/* Обновленный стиль для всех круглых игровых кнопок */
.ui-btn {
    width: 50px;           /* Немного увеличили размер (было 45px) */
    height: 50px;          /* Чтобы по кнопкам было легче попадать */
    background: #1e1e24;   /* Контрастный глубокий темный цвет вместо полупрозрачного */
    border: 2px solid rgba(255, 255, 255, 0.4); /* Четкая полупрозрачная белая обводка */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;       /* Слегка увеличили иконки внутри */
    cursor: pointer;
    /* Мощная, объемная тень, которая приподнимает кнопки над фоном */
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6); 
    transition: all 0.2s ease;
    margin: 0 !important;
}

/* Эффект при наведении (для ПК) или легком удержании */
.ui-btn:hover {
    border-color: #ffd700; /* Обводка становится золотой */
    transform: translateY(-2px); /* Кнопка слегка приподнимается */
}

/* Эффект при нажатии */
.ui-btn:active { 
    transform: scale(0.9) translateY(0); 
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.8);
}


.left-ui-container .lock-btn.active {
    background: #ff4757;
    transform: scale(1.1);
    box-shadow: 0 0 15px #ff4757;
}
.ui-btn.liked { color: #ff4757; text-shadow: 0 0 10px #ff4757; }

/* Профиль (шторка) */
.profile-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100%;
    background: #1e1e24;
    z-index: 200;
    transition: right 0.3s ease;
    box-sizing: border-box;
    padding: 20px;
    overflow-y: auto;
}
.profile-panel.open { right: 0; }

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}
.close-profile { font-size: 28px; cursor: pointer; }

.profile-info {
    text-align: center;
    padding: 20px 0;
}
.avatar { font-size: 50px; margin-bottom: 10px; }
.user-lvl-badge {
    background: #ffd700;
    color: #000;
    padding: 4px 12px;
    border-radius: 12px;
    display: inline-block;
    font-weight: bold;
}
.user-rank { margin-top: 5px; color: #aaa; font-size: 14px; }

/* Календарь ежедневных наград */
.daily-rewards-section {
    background: #2a2a32;
    border-radius: 12px;
    padding: 15px;
    margin-top: 20px;
}
.daily-rewards-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.timer-text { font-size: 12px; padding: 4px 8px; border-radius: 6px; }

.rewards-calendar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}
.reward-day {
    background: #1e1e24;
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    font-size: 11px;
    border: 1px solid transparent;
}
.reward-day.completed { opacity: 0.5; border-color: #2ed573; background: rgba(46, 213, 115, 0.05); }
.reward-day.current { border-color: #ffd700; background: rgba(255, 215, 0, 0.1); }
.day-icon { font-size: 18px; margin: 4px 0; }

.claim-reward-btn {
    width: 100%;
    background: #2ed573;
    border: none;
    padding: 12px;
    border-radius: 8px;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
}
.claim-reward-btn:disabled { background: #444; cursor: not-allowed; }

/* Купоны */
.coupons-section { margin-top: 25px; }
.coupon-card {
    background: #2a2a32;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.coupon-code-text { font-family: monospace; color: #ffd700; margin-top: 4px; font-size: 14px; }
.copy-btn {
    background: #1e90ff;
    border: none;
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
}
.copy-btn.copied { background: #2ed573; }
.empty-text { color: #666; font-size: 14px; text-align: center; }

.reset-profile-btn {
    width: 100%;
    background: none;
    border: 1px solid #ff4757;
    color: #ff4757;
    padding: 10px;
    border-radius: 8px;
    margin-top: 30px;
    cursor: pointer;
}

/* Модальные окна */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 500;
}
.modal-content {
    background: #2a2a32;
    padding: 25px;
    border-radius: 16px;
    text-align: center;
    max-width: 300px;
    width: 80%;
}
.modal-title { font-size: 22px; font-weight: bold; margin-bottom: 15px; }
.modal-title.levelup { color: #ffd700; }
.modal-text { font-size: 14px; white-space: pre-line; line-height: 1.4; margin-bottom: 20px; }
.modal-btn {
    background: #ffd700;
    color: #000;
    border: none;
    padding: 10px 25px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
}

/* Летящие монеты */
.flying-coin {
    position: fixed;
    font-size: 24px;
    z-index: 999;
    transition: transform 0.65s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.65s;
    pointer-events: none;
}

/* Салют конфетти */
.confetti-container {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}
.confetti-piece {
    position: absolute;
    width: 10px; height: 10px;
    border-radius: 2px;
    opacity: 0;
    animation: confettiExplode 2s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}
@keyframes confettiExplode {
    0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
    30% { opacity: 1; }
    100% { transform: translate(var(--translateX), var(--translateY)) rotate(var(--rotate)) scale(0.4); opacity: 0; }
}
/* =========================================================================
   ОБНОВЛЕННЫЙ СТИЛЬНЫЙ МАГАЗИН (КИБЕРПАНК / PREMIUM ДИЗАЙН)
   ========================================================================= */

/* Кнопка открытия магазина в профиле */
.shop-toggle-btn {
    width: 100%;
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
    border: none;
    padding: 14px;
    border-radius: 12px;
    color: #000;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.shop-toggle-btn:active {
    transform: scale(0.97);
    box-shadow: 0 2px 5px rgba(255, 215, 0, 0.1);
}

/* Контейнер секции магазина */
.shop-section {
    background: #23232f; /* Более глубокий оттенок */
    border-radius: 16px;
    padding: 18px;
    margin-top: 15px;
    border: 1px solid rgba(255, 215, 0, 0.15);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4);
}

/* Шапка магазина */
.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.shop-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    background: linear-gradient(90deg, #fff, #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.back-to-profile-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
}
.back-to-profile-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Переключатели категорий (Табы) */
.shop-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.shop-tabs::-webkit-scrollbar { display: none; } /* Скрываем полосу прокрутки */
.shop-tab {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #aaa;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.shop-tab.active {
    background: rgba(255, 215, 0, 0.12);
    border-color: #ffd700;
    color: #ffd700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

/* Карточка товара с неоновым глянцем */
.shop-item-card {
    background: linear-gradient(145deg, #1d1d26 0%, #16161e 100%);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
/* Легкий неоновый контур при наведении */
.shop-item-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 215, 0, 0.3);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4), 0 0 10px rgba(255, 215, 0, 0.05);
}

/* Оформление информации о товаре */
.shop-item-flex {
    display: flex;
    align-items: center;
    gap: 12px;
}
.shop-item-icon {
    font-size: 24px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}
.shop-item-info h4 {
    margin: 0 0 3px 0;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}
.shop-item-info p {
    margin: 0 0 5px 0;
    font-size: 11px;
    color: #999;
    line-height: 1.3;
}
.shop-item-price {
    font-weight: 800;
    color: #ffd700;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Крутые кнопки действий */
.shop-btn {
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 12px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
    min-width: 85px;
    text-align: center;
}
/* Кнопка: Купить */
.shop-btn.buy {
    background: #ffd700;
    color: #000;
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.2);
}
.shop-btn.buy:hover {
    background: #ffea75;
    transform: scale(1.03);
}
/* Кнопка: Надеть */
.shop-btn.equip {
    background: rgba(30, 144, 255, 0.15);
    color: #1e90ff;
    border: 1px solid rgba(30, 144, 255, 0.4);
}
.shop-btn.equip:hover {
    background: #1e90ff;
    color: #fff;
    box-shadow: 0 4px 12px rgba(30, 144, 255, 0.3);
}
/* Кнопка: Надето (Активно) */
.shop-btn.equipped {
    background: rgba(46, 213, 115, 0.15);
    color: #2ed573;
    border: 1px solid rgba(46, 213, 115, 0.3);
    cursor: default;
    pointer-events: none;
}
/* Блок авторизации по ID устройства */
.device-auth-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 15px;
    margin: 20px 0;
    text-align: left;
}
.device-auth-section h4 {
    margin: 0 0 8px 0;
    color: #ffd700;
    font-size: 15px;
}
.auth-desc {
    font-size: 11px;
    color: #aaa;
    margin: 0 0 10px 0;
    line-height: 1.4;
}
.auth-id-container {
    display: flex;
    background: #111;
    border: 1px solid #444;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
    align-items: center;
}
.device-id-text {
    flex-grow: 1;
    font-family: monospace;
    font-size: 11px;
    padding: 10px;
    color: #2ed573;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.copy-device-btn {
    background: #333;
    border: none;
    color: #fff;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}
.copy-device-btn:hover {
    background: #444;
}
.recovery-box {
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    padding-top: 12px;
}
.recovery-inputs {
    display: flex;
    gap: 8px;
}
.recovery-inputs input {
    flex-grow: 1;
    background: #111;
    border: 1px solid #444;
    border-radius: 6px;
    color: #fff;
    padding: 8px;
    font-size: 12px;
    outline: none;
}
.recovery-inputs input:focus {
    border-color: #ffd700;
}
.recovery-inputs button {
    background: #1e90ff;
    border: none;
    color: #fff;
    border-radius: 6px;
    padding: 8px 15px;
    font-weight: bold;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.recovery-inputs button:hover {
    background: #117ee6;
}

