/* Сброс стилей и базовые настройки */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--tg-theme-bg-color, #0f0f1e);
    color: var(--tg-theme-text-color, #ffffff);
    position: relative;
}

/* Переменные для Telegram тем */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gold-gradient: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    /* Увеличение размера колеса в 1.25 раза */
    --wheel-size: min(300px, 50.75vw);
    --safe-area-top: env(safe-area-inset-top, 20px);
    --safe-area-bottom: env(safe-area-inset-bottom, 20px);
    --inner-wheel-scale: 1.13; 
    /* <<< НОВОЕ: Переменные для смещения колеса >>> */
    /* Положительные значения двигают вправо/вниз, отрицательные - влево/вверх */
    --inner-wheel-offset-x: 0px;
    --inner-wheel-offset-y: 0px;
    --stat-icon-width: 48px;
    --stat-icon-height: 48px;
    --pointer-width: 48px;   /* Можно менять из JS */
    --pointer-height: 66px;  /* Можно менять из JS */
}

/* Основная обертка */
.app-wrapper {
    width: 100%;
    height: 100%;
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: url('../static/background.png');
    background-size: 100% 100%;
    /* ИЗМЕНЕНИЕ: Заменяем background-position */
    background-position: center bottom; /* Было: center */
    background-repeat: no-repeat;
}

/* Фоновые эффекты */
.background-effects {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}
.gradient-orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.2; }
.orb-1 { width: 350px; height: 350px; background: radial-gradient(circle, #667eea 0%, transparent 70%); top: -150px; left: -150px; animation: float-1 20s infinite ease-in-out; }
.orb-2 { width: 300px; height: 300px; background: radial-gradient(circle, #f093fb 0%, transparent 70%); bottom: -150px; right: -150px; animation: float-2 25s infinite ease-in-out; }
.orb-3 { width: 250px; height: 250px; background: radial-gradient(circle, #4facfe 0%, transparent 70%); top: 50%; left: 50%; transform: translate(-50%, -50%); animation: float-3 30s infinite ease-in-out; }
@keyframes float-1 { 0%, 100% { transform: translate(0, 0) rotate(0deg); } 33% { transform: translate(40px, -40px) rotate(120deg); } 66% { transform: translate(-30px, 30px) rotate(240deg); } }
@keyframes float-2 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-40px, -40px) scale(1.1); } }
@keyframes float-3 { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -50%) scale(0.9); } }

/* Основной контент */
.main-content {
    width: 100%;
    max-width: 480px; /* Keep max-width for overall layout */
    height: 100%;
    padding: var(--safe-area-top) 20px var(--safe-area-bottom);
    display: flex;
    flex-direction: column;
    align-items: center;
    /* --- DELETE --- */
    /* justify-content: space-evenly; */ /* УДАЛЯЕМ ЭТО ПРАВИЛО */
    position: relative;
    z-index: 1;
}

/* +++ Стили для наших новых "пружин" +++ */
.spacer-top, .spacer-bottom {
    width: 100%;
    flex-shrink: 0;
}

.spacer-top {
    flex-grow: 1; /* Эта распорка будет в 2 раза больше нижней */
    min-height: 20px;
}

.spacer-bottom {
    flex-grow: 0.5; /* Эта распорка будет в 2 раза меньше верхней */
    min-height: 20px;
}

/* Заголовок */
.app-header { text-align: center; margin-bottom: 0; 
    margin-top: 40px;
}
.app-title { font-size: 36px; font-weight: 800; background: var(--gold-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; text-shadow: 0 2px 10px rgba(255, 215, 0, 0.3); margin-top: 20px; }
.app-tagline { font-size: 16px; color: var(--tg-theme-hint-color, #aaa); }

/* Секция колеса */
.wheel-section {
    position: relative;
    margin-bottom: -150px;
    margin-top: 100px;
    flex-shrink: 0; 
    
    /* 
      +++ ЭТО НАШ НОВЫЙ ЦЕНТР УПРАВЛЕНИЯ МАСШТАБОМ +++
      min() выберет наименьшее из значений:
      - 90vw: 90% от ширины экрана (оставляет отступы по 5% с каждой стороны).
      - 380px: Максимальная ширина, до которой колесо будет расти на больших экранах.
      - 55vh: 55% от ВЫСОТЫ экрана. Это не даст колесу вылезти за пределы на "коротких" экранах.
      Ты можешь менять эти три значения, чтобы идеально настроить масштаб.
    */
    --wheel-size: min(88vw, 380px, 62vh, 380px);
    width: var(--wheel-size);
    height: var(--wheel-size);

    /* Остальные свойства остаются без изменений */
    transform-origin: center center;
    --ring-scale: 1.25;
    --ring-offset-y: 20px;
}

/* <<< ИЗМЕНЕНИЕ: Полностью заменяем стили для декорации >>> */
.wheel-decoration {
    position: absolute;
    top: 50%;
    left: 50%;
    
    /* Используем переменные для трансформации и настройки положения */
    /* --decoration-offset-x: смещение по горизонтали (например, 10px или -5%) */
    /* --decoration-offset-y: смещение по вертикали (например, 5px или 2%) */
    transform: translate(
        calc(-50% + var(--decoration-offset-x, 0px)), 
        calc(-50% + var(--decoration-offset-y, 0px))
    ) translateY(var(--ring-offset-y)) scale(var(--ring-scale));

    /* Масштабируем сам контейнер, чтобы PNG не обрезался */
    width: 100%; 
    height: 100%; 
    pointer-events: none; 
    
    /* Задаем фон с вашим PNG */
    background-image: url('../static/outer-ring.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 5;
    
}

@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.inner-glow { position: absolute; 
    /* Увеличение отступа свечения в 1.25 раза */
    inset: -25px; 
    border-radius: 50%; background: radial-gradient(circle, rgba(255, 215, 0, 0.1) 0%, transparent 70%); animation: pulse 2s infinite ease-in-out; 
}
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 0.5; } 50% { transform: scale(1.25); opacity: 0.1; } }

.wheel-pointer {
    position: absolute;
    top: -36px; /* Можно скорректировать */
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    width: var(--pointer-width);
    height: var(--pointer-height);
    background: url('/static/pointer.png') no-repeat center center;
    background-size: contain;
    pointer-events: none;
    /* Можно добавить анимацию, если нужно */
    animation: pointer-bounce 2.5s infinite ease-in-out;
  }


/* <<< ЗАМЕНИТЬ СТАРУЮ АНИМАЦИЮ pointer-bounce >>> */
@keyframes pointer-bounce {
    0%, 100% {
        /* <<< ИЗМЕНЕНО: Добавляем scale(0.95) >>> */
        transform: translateX(-50%) translateY(0) scale(0.95);
    }
    50% {
        /* <<< ИЗМЕНЕНО: Добавляем scale(0.95) >>> */
        transform: translateX(-50%) translateY(8px) scale(0.95);
    }
}



#canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    /* box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.05), inset 0 0 35px rgba(0,0,0,0.3); */
    transition: filter 0.3s ease, transform 0.3s ease;
    will-change: filter, transform;
    -webkit-transform: translate3d(0,0,0);
    transform: translate3d(0,0,0);
    -webkit-perspective: 1000;
    perspective: 1000;
    z-index: 0;
}

/* Класс для свечения canvas во время анимации победителя */
.winner-glow {
    animation: epicWinnerGlow 3s ease-in-out;
}

@keyframes epicWinnerGlow {
    0% {
        box-shadow: 
            0 0 17px rgba(255, 255, 255, 0.8),
            0 0 34px rgba(255, 215, 0, 0.6);
        transform: scale(1);
    }
    10% {
        box-shadow: 
            0 0 51px rgba(255, 255, 255, 1),
            0 0 68px rgba(255, 215, 0, 0.9),
            0 0 85px rgba(255, 165, 0, 0.7);
        transform: scale(1.05);
    }
    25% {
        box-shadow: 
            0 0 34px rgba(255, 255, 255, 0.9),
            0 0 51px rgba(255, 215, 0, 0.8),
            0 0 68px rgba(255, 20, 147, 0.6);
        transform: scale(1.02);
    }
    50% {
        box-shadow: 
            0 0 42.5px rgba(255, 255, 255, 1),
            0 0 59.5px rgba(255, 215, 0, 0.9),
            0 0 76.5px rgba(0, 255, 255, 0.7);
        transform: scale(1.03);
    }
    75% {
        box-shadow: 
            0 0 29.75px rgba(255, 255, 255, 0.8),
            0 0 46.75px rgba(255, 215, 0, 0.7),
            0 0 63.75px rgba(255, 105, 180, 0.5);
        transform: scale(1.01);
    }
    100% {
        box-shadow: 
            0 0 12.75px rgba(255, 255, 255, 0.5),
            0 0 21.25px rgba(255, 215, 0, 0.3);
        transform: scale(1);
    }
}

#text-canvas {
    z-index: 2; /* Верхний слой - текст */
    pointer-events: none; /* Делаем его "прозрачным" для кликов */
}

/* <<< НОВОЕ: Стили для позиционирования холстов >>> */
#canvas, #text-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translate(var(--inner-wheel-offset-x), var(--inner-wheel-offset-y)) scale(var(--inner-wheel-scale));
    z-index: 2;
}

#canvas {
    z-index: 0; /* Нижний слой - колесо */
}



/* <<< СТАЛО: .wheel-wrapper снова контейнер, а рамка на псевдо-элементе >>> */
.wheel-wrapper {
    position: absolute;
    overflow: visible !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    /* Убираем фон отсюда */

    filter: drop-shadow(0 31.25px 62.5px rgba(0, 0, 0, 0.3));
    z-index: 4; 
}


.wheel-wrapper canvas {
    position: absolute;
    top: 0;
    left: 0;
    /* Заставляем холст высокого разрешения вписаться в контейнер */
    width: 100%;
    height: 100%;
}

.wheel-wrapper.winner-glow::before {
    animation: outerRingGlow 3s ease-in-out;
}

@keyframes outerRingGlow {
    0%, 100% { opacity: 0; }
    20%, 80% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Эффект пульсации для всего контейнера */
.wheel-wrapper.winner-glow {
    animation: containerPulse 3s ease-in-out;
}

@keyframes containerPulse {
    0%, 100% { 
        filter: drop-shadow(0 31.25px 62.5px rgba(0, 0, 0, 0.3)); 
    }
    25% { 
        filter: drop-shadow(0 31.25px 62.5px rgba(0, 0, 0, 0.3))
                drop-shadow(0 0 42.5px rgba(255, 215, 0, 0.4)); /* 50 * 0.85 = 42.5 */
    }
    50% { 
        filter: drop-shadow(0 31.25px 62.5px rgba(0, 0, 0, 0.3))
                drop-shadow(0 0 59.5px rgba(255, 215, 0, 0.6)) /* 70 * 0.85 = 59.5 */
                drop-shadow(0 0 85px rgba(255, 255, 255, 0.3)); /* 100 * 0.85 = 85 */
    }
    75% { 
        filter: drop-shadow(0 31.25px 62.5px rgba(0, 0, 0, 0.3))
                drop-shadow(0 0 42.5px rgba(255, 215, 0, 0.4)); /* 50 * 0.85 = 42.5 */
    }
}
/* Анимация для текста на кнопке во время победы */
.spin-button.winner-celebration .button-text {
    animation: textCelebration 3s ease-in-out;
}

@keyframes textCelebration {
    0%, 100% { 
        transform: scale(1);
        color: inherit;
    }
    25% { 
        transform: scale(1.1);
        color: #FFD700;
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    }
    50% { 
        transform: scale(1.05);
        color: #FFFFFF;
        text-shadow: 0 0 15px rgba(255, 255, 255, 0.9);
    }
    75% { 
        transform: scale(1.08);
        color: #FF6B6B;
        text-shadow: 0 0 12px rgba(255, 107, 107, 0.7);
    }
}

/* Эффект для статистики во время победы */
.stats.winner-celebration {
    animation: statsGlow 3s ease-in-out;
}

@keyframes statsGlow {
    0%, 100% { 
        filter: none;
        transform: scale(1);
    }
    25% { 
        filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.6));
        transform: scale(1.02);
    }
    50% { 
        filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.8));
        transform: scale(1.03);
    }
    75% { 
        filter: drop-shadow(0 0 12px rgba(255, 107, 107, 0.5));
        transform: scale(1.01);
    }
}

/* Эффект для всего экрана */
.main-content.winner-celebration {
    animation: screenFlash 3s ease-in-out;
}

@keyframes screenFlash {
    0%, 100% { 
        background: inherit;
    }
    5% { 
        background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    }
    15% { 
        background: radial-gradient(circle at center, rgba(255, 215, 0, 0.05) 0%, transparent 70%);
    }
}

/* <<< ЗАМЕНЯЕМ ВЕСЬ БЛОК СТИЛЕЙ ДЛЯ .center-spin-button >>> */
/* --- "Призрачная" кнопка для обработки кликов --- */
.center-spin-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 160px;  /* Размер должен примерно соответствовать 3D модели */
    height: 160px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10; /* Убедимся, что она над 3D сценой */

    /* Делаем ее полностью невидимой */
    background: transparent;
    border: none;
    box-shadow: none;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Убираем все состояния и анимации, они теперь в 3D */
.center-spin-button::before,
.center-spin-button::after,
.center-spin-button:not(:disabled):active,
.center-spin-button:disabled,
.center-spin-button.spinning {
    background: transparent;
    box-shadow: none;
    filter: none;
    animation: none;
    transform: translate(-50%, -50%); /* Сбрасываем active transform */
}

/* Скрываем внутренние элементы старой кнопки */
.center-spin-button .button-inner {
    display: none;
}

/* ================================================================== */
/* <<< ОБНОВЛЕННЫЕ АНИМАЦИИ В ЗОЛОТОМ СТИЛЕ >>> */
/* ================================================================== */

/* --- ОСНОВНАЯ АНИМАЦИЯ ВРАЩЕНИЯ --- */
.center-spin-button.spinning {
    animation: spin-button-energize-gold 1.5s infinite ease-in-out;
}

@keyframes spin-button-energize-gold {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 
            0 12px 24px rgba(0, 0, 0, 0.4),
            inset 0 -5px 10px rgba(100, 60, 10, 0.7),
            inset 0 5px 10px rgba(255, 248, 220, 0.7);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05); /* Пульсация */
        box-shadow: 
            0 18px 36px rgba(0, 0, 0, 0.3), /* Тень шире */
            inset 0 -5px 10px rgba(223, 182, 0, 0.884),
            inset 0 5px 10px rgba(255, 248, 220, 0.7),
            /* <<< ЗОЛОТОЕ ВНЕШНЕЕ СВЕЧЕНИЕ >>> */
            0 0 60px rgba(255, 215, 0, 0.95); 
    }
}

/* --- АНИМАЦИЯ ПУЛЬСАЦИИ ГОТОВНОСТИ --- */
.center-spin-button:not(:disabled):not(.spinning) {
    animation: button-pulse-ready-gold 2s infinite ease-in-out;
}

@keyframes button-pulse-ready-gold {
    0%, 100% {
        filter: brightness(100%);
    }
    50% {
        filter: brightness(120%);
    }
}

/* --- АНИМАЦИЯ ВНУТРЕННЕГО СВЕЧЕНИЯ --- */
.button-inner::after { /* <<< ИСПОЛЬЗУЕМ ::AFTER, ЧТОБЫ НЕ КОНФЛИКТОВАТЬ >>> */
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 174, 0, 0.726) 0%, transparent 70%);
    opacity: 0;
    transform: scale(0);
    z-index: 1;
}

.center-spin-button.spinning .button-inner::after {
    animation: spin-button-glow-gold 1.5s infinite ease-in-out;
}

@keyframes spin-button-glow-gold {
    0%, 100% {
        opacity: 0;
        transform: scale(0);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
        background: radial-gradient(circle, rgba(255, 215, 0, 1) 0%, transparent 70%); /* Увеличиваем прозрачность до полной */
    }
}

/* Остальные стили без изменений */
.wheel-lights { position: absolute; 
    /* Увеличение отступа огней в 1.25 раза */
    inset: -37.5px; 
    pointer-events: none; 
}
.light { position: absolute; 
    /* Увеличение размера огней в 1.25 раза */
    width: 10px; 
    height: 10px; 
    background: #FFD700; border-radius: 50%; 
    /* Увеличение свечения огней в 1.25 раза */
    box-shadow: 0 0 12.5px #FFD700; 
    opacity: 0; animation: light-twinkle 3s infinite ease-in-out; 
    transform: scale(0.90);
    z-index: 10;
}
.light-1 { top: 511%; left: 50%; animation-delay: 0s; }
.light-2 { top: 50%; right: 8%; animation-delay: 0s; }
.light-3 { bottom: 8%; left: 50%; animation-delay: 0s; }
.light-4 { top: 50%; left: 9%; animation-delay: 0s; }
@keyframes light-twinkle { 0%, 100% { opacity: 0; transform: scale(0.5); } 50% { opacity: 1; transform: scale(1.2); } }

/* Обертка для всей нижней части, чтобы правильно расположить ссылку */
.stats-panel-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 400px;
    /* margin-top: auto; */
    margin-top: 65px;
    margin-bottom: -100px;
    
    /* --- DELETE: УДАЛЯЕМ ЭТИ СТРОКИ --- */
    /* position: relative; */
    z-index: 10;
    /* margin-top: clamp(-50px, -7vh, -25px); */
}

/* Основной контейнер панели */
.stats-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 8px 15px; /* Сделаем чуть компактнее по вертикали */
    border-radius: 25px;
    background: linear-gradient(160deg, rgba(154, 133, 240, 0.137) 0%, rgba(20, 15, 55, 0.9) 100%);
    backdrop-filter: blur(10px);
    border: 0px solid rgba(36, 112, 236, 0.788);
    box-shadow: 0 0 25px rgba(36, 112, 236, 0.589);
    opacity: 1;
}

/* Группа (иконка + текст) */
.stat-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Иконка (без изменений) */
.stat-icon {
    width: var(--stat-icon-width, 48px);
    height: var(--stat-icon-height, 48px);
    display: flex;
    align-items: center;
    justify-content: center;
}
.stat-icon img { max-width: 100%; max-height: 100%; }

/* Контейнер для текста (Лейбл + Значение) */
.stat-info {
    display: flex;
    flex-direction: column; /* Ставим элементы друг под другом */
}

/* Выравнивание текста для левой группы */
.spins-group .stat-info {
    align-items: flex-start; /* Прижимаем к левому краю */
}

/* Выравнивание текста для правой группы */
.points-group .stat-info {
    align-items: flex-end; /* Прижимаем к правому краю */
}

/* Стиль для текстовых лейблов ("Доступно Спинов", "Баллы лояльности") */
.stat-label {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--tg-theme-hint-color, #aaa); /* По умолчанию серый */
}

/* Кастомный цвет и свечение для лейбла спинов */
.spins-group .stat-label {
    color: #FFD700; /* Золотой */
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

/* Кастомный цвет и свечение для лейбла баллов */
.points-group .stat-label {
    color: #A0E9FF; /* Алмазный */
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
}

/* Стиль для цифр (значений) */
.stat-value {
    font-size: 26px; /* Чуть уменьшим для баланса */
    font-weight: 800;
    color: #fff;
    line-height: 1.1;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Иконки */
.stat-icon {
    /* <<< ИЗМЕНЕНО: Используем переменные >>> */
    width: var(--stat-icon-width);
    height: var(--stat-icon-height);
    
    display: flex;
    align-items: center;
    justify-content: center;
}
.stat-icon img {
    /* Эти свойства уже есть, они гарантируют, что PNG будет вписываться */
    max-width: 100%;
    max-height: 100%;
}

/* Ссылка под панелью */
.spend-link {
    margin-top: 15px; /* ИЗМЕНЕНИЕ: Уменьшаем отступ сверху, чтобы поднять ссылку */
    font-size: 15px;
    font-weight: 600;
    color: #8A72F1; /* Фирменный фиолетовый */
    cursor: pointer;
    text-shadow: 0 0 10px rgba(138, 114, 241, 0.5);
    transition: transform 0.2s, color 0.2s;
}
.spend-link:active {
    transform: scale(0.95);
    color: #a995ff;
}

/* <<< НОВЫЕ СТИЛИ ДЛЯ ТЕКСТА О КУРСЕ БАЛЛОВ >>> */
.points-rate-info {
    margin-top: 8px; /* Небольшой отступ от элемента выше */
    font-size: 12px;
    font-weight: 500;
    color: #8A72F1; /* Тот же цвет, что и у ссылки, для консистентности */
    text-shadow: 0 0 8px rgba(138, 114, 241, 0.4); /* Эффект свечения */
    opacity: 0.9; /* Слегка приглушаем, чтобы не был навязчивым */
    text-align: center;
}

.win-effects { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1000; }
.confetti-piece { position: absolute; width: 8px; height: 8px; background: #FFD700; animation: confetti-fall 3s linear forwards; }
@keyframes confetti-fall { 0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; } 100% { transform: translateY(100vh) rotate(720deg); opacity: 0; } }

/* Адаптивные стили также увеличены в 1.25 раза */
@media (max-height: 800px) { 
    :root { --wheel-size: min(450px, 106.25vw); } 
    .center-spin-button { width: 118px; height: 118px; } 
    .button-text { font-size: 34px; } 
    .app-title { font-size: 40px; } 
    .stats-panel { padding: 15px 25px; } 
}

@media (max-width: 380px) { 
    .main-content { padding-left: 18.75px; padding-right: 18.75px; } 
    .stats-panel { gap: 18.75px; padding: 15px 20px; } 
    .stat-card { gap: 10px; } 
    .stat-icon { font-size: 30px; } 
    .stat-value { font-size: 25px; } 
}

/* Новый стиль для Happy Hour индикатора в stats-panel */
.happy-hour-indicator {
    width: 100%;
    text-align: center;
    margin-top: 8px;
    padding: 6px 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    animation: happy-hour-glow 2s infinite ease-in-out;
    transform-origin: center;
}

.happy-hour-text {
    font-size: 14px;
    font-weight: 800;
    color: #000000;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
    letter-spacing: 0.5px;
    animation: happy-hour-text-shimmer 3s infinite ease-in-out;
}

@keyframes happy-hour-glow {
    0%, 100% {
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 25px rgba(255, 215, 0, 1), 0 0 50px rgba(255, 215, 0, 0.6);
        transform: scale(1.02);
    }
}

@keyframes happy-hour-text-shimmer {
    0%, 100% {
        text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
    }
    50% {
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 0 1px 2px rgba(255, 255, 255, 0.5);
    }
}

/* <<< НОВОЕ: Стили для Canvas с эффектами >>> */
#effects-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none; /* Делаем его "прозрачным" для кликов */
    z-index: 1; /* Убедимся, что он над основным canvas */
}

/* <<< СТАЛО: Позиционирование полностью в 3D, CSS только задает размер >>> */
#three-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* <<< СТАЛО: Упрощенная верстка, управляемая из JS >>> */
.plank-content {
    position: relative; /* Обязательно для позиционирования дочерних элементов */
    z-index: 1;
    width: 100%;
    height: 100%;
    font-family: var(--manrope-font, 'Manrope', sans-serif);
}

/* Общий стиль для всех позиционируемых элементов внутри плашки */
/* <<< ОБНОВЛЕНО: Убираем transform, он теперь в JS >>> */
#prize-notification-title,
#prize-notification-prize-name,
#prize-notification-button {
    position: absolute;
    left: 50%;
    /* transform: translateX(-50%);  <<< УДАЛИТЕ ЭТУ СТРОКУ */
    width: 90%;
    text-align: center;
}
/* Индивидуальные стили (без позиционирования) */
#prize-notification-title {
    font-size: clamp(1.1rem, 4vw, 1.6rem);
    font-weight: 800;
    color: #FFEFD5;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

#prize-notification-prize-name {
    font-size: clamp(1.4rem, 5vw, 2rem);
    font-weight: 900;
    line-height: 1.2;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: text-shadow 0.3s ease;
}

#prize-notification-button {
    font-size: clamp(1rem, 3.8vw, 1.4rem);
    font-weight: 800;
    text-transform: uppercase;
    padding: 3% 10%; /* Немного скорректируем паддинги */
    min-width: 50%;
    max-width: 80%;
    border-radius: 14px;
    border-width: 2px;
    border-style: solid;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2), inset 0 1px 2px rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
}

/* --- Стили для экрана загрузки --- */
#loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #11141a; /* Темный фон в стиле приложения */
    z-index: 10000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.5s ease-out;
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10+ */
    user-select: none;
}

#loader-overlay.hidden {
    opacity: 0;
    pointer-events: none; /* Делаем некликабельным во время исчезновения */
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top-color: #6f00ff; /* Яркий акцентный цвет */
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loader-text {
    font-family: 'Manrope', sans-serif;
    font-size: 24px;
    font-weight: 800;
    color: #e2e8f0;
    letter-spacing: 1px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* <<< НОВЫЕ СТИЛИ ДЛЯ СПИСКА ПРИЗОВ >>> */

/* Контейнер для кнопок вверху */
.top-buttons-container {
    position: absolute;
    top: calc(var(--safe-area-top, 20px) + 10px);
    right: 20px;
    z-index: 500;
    display: flex;
    gap: 10px; /* Расстояние между кнопками */
}

/* Общий стиль для верхних кнопок */
.top-button {
    width: 44px;
    height: 44px;
    background: linear-gradient(160deg, rgba(154, 133, 240, 0.25) 0%, rgba(20, 15, 55, 0.8) 100%);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(138, 114, 241, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    text-decoration: none;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.top-button:active {
    transform: scale(0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}


/* Оверлей (фон) */
.prize-info-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.prize-info-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Модальное окно */
.prize-info-modal {
    width: 90%;
    max-width: 420px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(160deg, rgba(154, 133, 240, 0.137) 0%, rgba(20, 15, 55, 0.9) 100%);
    border-radius: 20px;
    border: 1px solid rgba(138, 114, 241, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    padding: 20px;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.prize-info-overlay.visible .prize-info-modal {
    transform: scale(1);
}

/* Кнопка закрытия */
.prize-info-close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 5px;
}

/* Заголовок модального окна */
.prize-info-title {
    font-size: 22px;
    text-align: center;
    margin-bottom: 20px;
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Контейнер для списка призов (теперь содержит аккордеон) */
.prize-info-content {
    overflow-y: auto;
    padding-right: 10px; /* Отступ для скроллбара */
}

/* Элемент аккордеона (заголовок + контент) */
.accordion-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.accordion-item:last-child {
    border-bottom: none;
}

/* Заголовок аккордеона (кликабельная часть) */
.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 5px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
}

/* Индикатор-стрелка (▼) */
.accordion-indicator {
    transition: transform 0.3s ease;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
}

/* Контент аккордеона (скрытая часть) */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    padding: 0 15px;
}

/* Стили для активного (раскрытого) элемента */
.accordion-item.active .accordion-content {
    max-height: 600px; /* Достаточно большая высота для контента */
    padding: 0 15px 20px;
}
.accordion-item.active .accordion-indicator {
    transform: rotate(180deg);
}


/* Стили для элементов внутри контента аккордеона */
.prize-item {
    padding: 12px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.prize-item:first-child {
    border-top: none;
}

.prize-item-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
}
.prize-item-description {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
}

/* <<< Цветовое кодирование и свечение для редкостей >>> */
/* Common (Белый) */
.accordion-header[data-rarity="common"],
.prize-item-name[data-rarity="common"] {
    color: #FFFFFF;
}

/* Rare (Синий) */
.accordion-header[data-rarity="rare"],
.prize-item-name[data-rarity="rare"] {
    color: #55B5FF;
    text-shadow: 0 0 8px rgba(85, 181, 255, 0.6);
}

/* Epic (Рубиновый) */
.accordion-header[data-rarity="epic"],
.prize-item-name[data-rarity="epic"] {
    color: #E64980;
    text-shadow: 0 0 8px rgba(230, 73, 128, 0.7);
}

/* Legendary (Золотой) */
.accordion-header[data-rarity="legendary"],
.prize-item-name[data-rarity="legendary"] {
    color: #FFD700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.7);
}

/* Mythic (Циан) */
.accordion-header[data-rarity="mythic"],
.prize-item-name[data-rarity="mythic"] {
    color: #4DFFFF;
    text-shadow: 0 0 10px rgba(77, 255, 255, 0.8);
}

/* Контент с призами */
.prize-info-content {
    overflow-y: auto;
    padding-right: 10px;
}

.prize-content-pane {
    display: none;
}
.prize-content-pane.active {
    display: block;
}

/* <<< НОВОЕ: Заголовок для группы призов >>> */
.prize-group-header {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 15px;
    text-align: center;
}

.prize-item {
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.prize-item:last-child {
    border-bottom: none;
}

.prize-item-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
}
.prize-item-description {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
}

/* <<< НОВОЕ: Цветовое кодирование и свечение для редкостей >>> */
/* Common */
.prize-group-header[data-rarity="common"],
.prize-item-name[data-rarity="common"] {
    color: #FFFFFF;
}

/* Rare (Синий) */
.prize-group-header[data-rarity="rare"],
.prize-item-name[data-rarity="rare"] {
    color: #55B5FF;
    text-shadow: 0 0 8px rgba(85, 181, 255, 0.6);
}

/* Epic (Рубиновый/Розовый) */
.prize-group-header[data-rarity="epic"],
.prize-item-name[data-rarity="epic"] {
    color: #E64980;
    text-shadow: 0 0 8px rgba(230, 73, 128, 0.7);
}

/* Legendary (Золотой) */
.prize-group-header[data-rarity="legendary"],
.prize-item-name[data-rarity="legendary"] {
    color: #FFD700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.7);
}

/* Mythic (Циан/Бирюзовый) */
.prize-group-header[data-rarity="mythic"],
.prize-item-name[data-rarity="mythic"] {
    color: #4DFFFF;
    text-shadow: 0 0 10px rgba(77, 255, 255, 0.8);
}

/* Контент с призами */
.prize-info-content {
    overflow-y: auto;
    padding-right: 10px; /* Отступ для скроллбара */
}

.prize-content-pane {
    display: none;
}
.prize-content-pane.active {
    display: block;
}

.prize-item {
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.prize-item:last-child {
    border-bottom: none;
}

.prize-item-name {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}
.prize-item-description {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
}

/* Стилизация скроллбара */
.prize-info-content::-webkit-scrollbar {
  width: 5px;
}
.prize-info-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}
.prize-info-content::-webkit-scrollbar-thumb {
  background: #8A72F1;
  border-radius: 10px;
}

/* <<< НОВЫЕ СТИЛИ ДЛЯ КОНТЕНТА ТАБЛИЦЫ ЛИДЕРОВ >>> */
.leaderboard-content {
    overflow-y: auto;
    height: 100%;
    padding-right: 10px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-prize-name {
    font-size: 15px;
    font-weight: 600;
    flex-grow: 1;
}

.leaderboard-timestamp {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    margin-left: 15px;
}

/* Применяем те же стили редкости к именам призов в таблице лидеров */
.leaderboard-prize-name[data-rarity="rare"] {
    color: #55B5FF;
    text-shadow: 0 0 8px rgba(85, 181, 255, 0.6);
}
.leaderboard-prize-name[data-rarity="epic"] {
    color: #E64980;
    text-shadow: 0 0 8px rgba(230, 73, 128, 0.7);
}
.leaderboard-prize-name[data-rarity="legendary"] {
    color: #FFD700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.7);
}
.leaderboard-prize-name[data-rarity="mythic"] {
    color: #4DFFFF;
    text-shadow: 0 0 10px rgba(77, 255, 255, 0.8);
}