/* === KEYFRAMES & ANIMATIONS === */

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Улучшенная flip-анимация для карточки */
@keyframes cardFlip {
    0% {
        transform: rotateY(0deg) scale(1);
        filter: brightness(1);
    }
    50% {
        transform: rotateY(90deg) scale(1.05);
        filter: brightness(1.2);
    }
    100% {
        transform: rotateY(0deg) scale(1);
        filter: brightness(1);
    }
}

/* Градиентный поток для текста */
@keyframes gradientFlow {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

/* Shimmer эффект для кнопок */
@keyframes shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Ripple эффект - ОТКЛЮЧЕН */
@keyframes rippleExpand {
    from {
        width: 0;
        height: 0;
        opacity: 0;
    }
    to {
        width: 0;
        height: 0;
        opacity: 0;
    }
}

/* Ripple класс - ОТКЛЮЧЕН */
.click-ripple {
    display: none;
}

/* Bounce для тостов */
@keyframes toastBounce {
    0% {
        transform: translateY(100px) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translateY(-10px) scale(1.05);
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Появление слотов с задержкой */
@keyframes slotFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Улучшенное конфетти с вращением */
@keyframes confettiSpin {
    0% {
        transform: translateY(-100vh) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(1080deg) scale(0.5);
        opacity: 0;
    }
}

/* Пульсация для легендарных карт */
@keyframes legendaryPulse {
    0%, 100% {
        box-shadow:
            0 0 30px rgba(255, 179, 0, 0.6),
            0 0 60px rgba(255, 179, 0, 0.4),
            inset 0 0 20px rgba(255, 179, 0, 0.2);
        filter: brightness(1);
    }
    50% {
        box-shadow:
            0 0 50px rgba(255, 179, 0, 0.8),
            0 0 100px rgba(255, 179, 0, 0.6),
            inset 0 0 30px rgba(255, 179, 0, 0.3);
        filter: brightness(1.1);
    }
}

/* Прогресс-бар анимация */
@keyframes progressShine {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes progressGlide {
    to { left: 100%; }
}

/* Градиентный сдвиг фона */
@keyframes gradientShift {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes burstExpand {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
}

/* Particle Trail Animation */
@keyframes particleTrail {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* Screen Flash for Legendary Drops */
@keyframes screenFlash {
    0% { opacity: 0; }
    50% { opacity: 0.8; }
    100% { opacity: 0; }
}

/* Pulse Glow for Available Actions */
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 10px currentColor; }
    50% { box-shadow: 0 0 25px currentColor, 0 0 40px currentColor; }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    pointer-events: none;
    z-index: 9999;
    animation: confettiSpin 3s linear forwards;
}

.rarity-burst {
    position: fixed;
    width: 200px;
    height: 200px;
    border: 3px solid;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    animation: burstExpand 1s ease-out forwards;
}

/* Particle Trail Effect */
.particle-trail {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9997;
    animation: particleTrail 1s ease-out forwards;
    /* Адаптивное масштабирование партиклов (п. 1.10.1) - применяется через JS */
    transform-origin: center center;
}

/* Screen Flash Overlay */
.screen-flash {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9996;
    animation: screenFlash 0.5s ease-out forwards;
}

/* === CSS VARIABLES FOR RESPONSIVE SCALING (п. 1.10.1) === */
:root {
    --game-scale: 1;
    --modal-scale: 1;
    --panel-scale: 1;
}

/* Применяем масштабирование ко всем контейнерам с overflow */
.modal-body,
.shop-list,
.ach-list,
.album-grid,
#activeSlots,
#inventorySlots {
    /* Предотвращаем обрезку при масштабировании */
    box-sizing: border-box;
}

/* === BASE RESET === */
html {
    margin: 0;
    padding: 0;
    position: fixed;
    overflow: hidden;
    width: 100%;
    height: 100%;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
    background: #050505 !important;
}

body {
    margin: 0;
    padding: 0;
    position: fixed;
    overflow: hidden;
    width: 100%;
    height: 100%;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
    background: radial-gradient(circle at 50% 40%, #1a1a2e 0%, #050505 80%) !important;
    background-attachment: fixed !important;
    color: white;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
    touch-action: pan-y pinch-zoom; /* Разрешаем вертикальный скролл и зум */
}

/* Скрываем контент до полной загрузки и локализации */
body:not(.game-ready) {
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

body.game-ready {
    opacity: 1;
}

/* Глобальное отключение выделения текста */
* {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}

/* Разрешаем выделение только в input полях */
input, textarea {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

/* Динамический градиентный фон */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(255, 215, 0, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(74, 163, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(180, 76, 255, 0.05) 0%, transparent 60%);
    animation: gradientShift 15s ease infinite;
    pointer-events: none;
    z-index: 0;
}

/* Сетка на фоне */
body::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 1;
    pointer-events: none;
}

button {
    cursor: pointer;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    /* Отключаем transform на мобильных по умолчанию */
    -webkit-transform: none;
    transform: none;
}

button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    pointer-events: none;
}

button:hover::before {
    width: 300px;
    height: 300px;
}

/* Применяем scale только на десктопе */
@media (min-width: 769px) {
    button:active {
        transform: scale(0.96);
    }
}

/* === LAYOUT PANELS === */
.top-left-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 20;
    transform-origin: top left;
    transition: transform 0.15s ease-out;
    will-change: transform;
}

.top-right-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    text-align: right;
    z-index: 19; /* Below overlays (100) but above game elements */
    transform-origin: top right;
    transition: transform 0.15s ease-out;
    will-change: transform;
}

/* Скрываем настройки когда открыто модальное окно */
.overlay:not(.hidden) ~ * .top-right-panel,
body:has(.overlay:not(.hidden)) .top-right-panel {
    z-index: 0; /* Опускаем под модальные окна */
}

.menu-btn {
    background: #1a1a1a;
    color: #ccc;
    padding: 10px 15px;
    border: 1px solid #333;
    font-size: 13px;
    min-width: 100px;
    transition: all 0.2s;
}
.menu-btn:hover { background: #2a2a2a; border-color: #555; }

.menu-btn.active {
    background: #4caf50;
    color: #fff;
    border-color: #45a049;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.4);
}

/* ADS BUTTON */
.ads-btn {
    border-color: #ffd700;
    color: #ffd700;
    background: rgba(255, 215, 0, 0.05);
}
.ads-btn:hover { background: rgba(255, 215, 0, 0.15); box-shadow: 0 0 10px rgba(255,215,0,0.2); }

/* === GAME MIDDLE === */
.game {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    z-index: 10;
    /* Адаптивное масштабирование для предотвращения обрезки (п. 1.10.1) */
    transform-origin: center center;
    /* Убираем ограничения, масштабирование управляется JS */
    box-sizing: border-box;
    transition: transform 0.15s ease-out;
    /* Предотвращаем обрезку при масштабировании */
    will-change: transform;
}

/* Контейнер для масштабирования всей игровой области */
.game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 10;
}

/* Масштабируемая обёртка */
.game-scaler {
    transform-origin: center center;
    transition: transform 0.2s ease-out;
}

/* MAIN COINS DISPLAY (CENTERED) - Улучшенный градиент */
.coins-display {
    font-size: 36px;
    font-weight: 900;
    background: linear-gradient(135deg, #FFD700, #FFA500, #FFD700);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientFlow 3s linear infinite;
    margin-bottom: 5px;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.6));
    letter-spacing: 1px;
    z-index: 15;
}

/* === BIG MYSTERY CARD (FULL IMAGE FIX) === */
.mystery-card {
    width: 240px;
    height: 360px; /* Сделал чуть выше для красоты */
    background: #000;
    border: 4px solid #333;
    border-radius: 20px;
    
    /* Флекс нужен только для позиционирования текста снизу */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end; /* Текст прижат к низу */
    
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
    position: relative; /* Обязательно для absolute детей */
    overflow: hidden; /* Обрезает картинку по закругленным краям */
    padding: 0 !important; /* Убираем любые отступы */
    
    /* Отключаем transform по умолчанию */
    -webkit-transform: none !important;
    transform: none !important;
    -webkit-transform-style: flat !important;
    transform-style: flat !important;
}

/* КАРТИНКА НА ВЕСЬ ЭКРАН */
.mystery-card img {
    position: absolute; /* Вырываем из потока */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Растягиваем с сохранением пропорций (Zoom) */
    z-index: 1; /* Самый нижний слой, под текстом */
}

/* Знак вопроса (для старта) */
#rollText { 
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 80px; 
    font-weight: 900; 
    color: #444; 
    z-index: 2;
}

/* Текст редкости (Плашка внизу) */
#rollRarity { 
    position: relative; /* Чтобы был поверх картинки */
    z-index: 10;
    margin-bottom: 25px; /* Отступ снизу */
    
    font-size: 14px; 
    color: #fff; 
    font-weight: 900; 
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 2px 4px #000;
    
    /* Полупрозрачная подложка, чтобы текст читался на фото */
    background: rgba(0, 0, 0, 0.7); 
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.2);
    backdrop-filter: blur(2px);
}


/* Animation Classes */
.mystery-card.shuffling {
    border-color: #fff;
    box-shadow: 0 0 30px rgba(255,255,255,0.15);
    animation: shake 0.08s infinite;
}
.mystery-card.revealed {
    animation: cardFlip 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Rarity Glows - Улучшенные */
.glow-rare {
    box-shadow: 0 0 50px rgba(74, 163, 255, 0.6), 0 0 100px rgba(74, 163, 255, 0.3);
    border-color: #4aa3ff;
    animation: pulseGlow 2s ease-in-out infinite;
}
.glow-epic {
    box-shadow: 0 0 60px rgba(180, 76, 255, 0.6), 0 0 120px rgba(180, 76, 255, 0.3);
    border-color: #b44cff;
    animation: pulseGlow 2s ease-in-out infinite;
}
.glow-legendary {
    animation: legendaryPulse 2s ease-in-out infinite;
    border-color: #ffb300;
}
.glow-mythic {
    box-shadow: 0 0 90px rgba(255, 60, 60, 0.7), 0 0 150px rgba(255, 60, 60, 0.4);
    border-color: #ff3c3c;
    animation: pulseGlow 1.5s ease-in-out infinite;
}

@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    50% { transform: translate(-1px, -2px) rotate(-1deg); }
    100% { transform: translate(-1px, 1px) rotate(1deg); }
}
@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0.5; }
    60% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); }
}

/* CONTROLS */
/* CONTROLS */
.controls { 
    display: flex; 
    gap: 20px; 
    align-items: flex-start; /* Выравнивание по верху */
}

/* Группа правой кнопки (Roll + Auto) */
.roll-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 160px; /* Фиксированная ширина колонки */
}

/* Общий стиль больших кнопок */
.action-btn {
    width: 160px;      /* Одинаковая ширина */
    height: 80px;      /* Фиксированная высота */
    font-size: 20px;   /* Крупный текст */
    font-weight: 900;
    
    background: #1a1a1a; 
    color: #fff;
    border: 2px solid #444; 
    box-shadow: 0 6px 0 #000; /* Глубокая тень нажатия */
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.action-btn:active { 
    transform: translateY(4px); 
    box-shadow: 0 2px 0 #000; 
}

/* Специфика для ROLL (Желтая) - Градиентная с shimmer */
#rollBtn {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4a 50%, #ffd700 100%);
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
    color: #000;
    border-color: #ffd700;
    box-shadow: 0 6px 0 #b29600, 0 0 20px rgba(255, 215, 0, 0.4);
    transform: none !important; /* Отключаем любые трансформации */
    transition: box-shadow 0.2s !important; /* Только тень меняется */
}

/* Отключаем глобальный ripple эффект для кнопки ROLL */
#rollBtn::before {
    display: none !important;
}

#rollBtn:hover {
    box-shadow: 0 6px 0 #b29600, 0 0 30px rgba(255, 215, 0, 0.6);
    transform: none !important; /* Полностью отключаем движение */
}

#rollBtn:active {
    box-shadow: 0 2px 0 #b29600;
    transform: none !important; /* Полностью отключаем движение */
}
#rollBtn:disabled { 
    background: #444; 
    color: #888; 
    border-color: #444;
    box-shadow: none; 
    transform: translateY(4px); /* Вдавленная */
}

/* Маленькая кнопка AUTO */
.auto-btn {
    background: #111;
    color: #666;
    border: 1px solid #333;
    padding: 8px 0;
    font-size: 11px;
    font-weight: bold;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
    width: 100%; /* Растягиваем под ширину rollBtn */
    transition: all 0.2s;
}

.auto-btn:hover { background: #222; color: #888; }

.auto-btn.active {
    background: #1c1; /* Ярко-зеленый */
    color: #000;
    border-color: #1f1;
    box-shadow: 0 0 10px #1f1;
}

/* === CLICK PARTICLE EFFECT === */
.click-particle {
    position: fixed;
    pointer-events: none;
    z-index: 2000;
    color: #fff;
    font-weight: 900;
    font-size: 28px;
    text-shadow: 0 4px 10px rgba(0,0,0,0.8);
    animation: floatUp 0.6s ease-out forwards;
    /* Адаптивное масштабирование партиклов (п. 1.10.1) - применяется через JS */
    transform-origin: center center;
}
.particle-crit {
    color: #ff3c3c;
    font-size: 40px;
    text-shadow: 0 0 20px rgba(255, 60, 60, 0.8);
}
.particle-boost {
    color: #00ff00;
    font-size: 32px;
    text-shadow: 0 0 15px rgba(0, 255, 0, 0.8);
}

@keyframes floatUp {
    0% { transform: translateY(0) scale(0.5); opacity: 0; }
    20% { transform: translateY(-10px) scale(1.2); opacity: 1; }
    100% { transform: translateY(-100px) scale(1); opacity: 0; }
}

/* === RIGHT PANEL (ACTIVE) === */
.active-panel {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 80px;
    max-height: 80vh; /* Ограничиваем высоту */
    background: rgba(15, 15, 15, 0.9);
    padding: 15px 10px 10px 10px;
    border-radius: 16px;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    backdrop-filter: blur(5px);
    overflow: hidden; /* Скрываем переполнение */
    transform-origin: right center;
    transition: transform 0.15s ease-out;
    will-change: transform;
}
.active-panel h3 {
    margin: 0 0 15px 0; font-size: 10px; color: #666;
    text-transform: uppercase; text-align: center;
    writing-mode: vertical-rl; text-orientation: mixed; transform: rotate(180deg);
    flex-shrink: 0; /* Заголовок не сжимается */
}
#activeSlots {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto; /* Добавляем вертикальный скролл */
    overflow-x: hidden;
    padding-right: 5px; /* Отступ для скроллбара */
    /* Скрываем скроллбар но оставляем функциональность */
    scrollbar-width: thin;
    scrollbar-color: #444 transparent;
}
/* Стилизация скроллбара для webkit браузеров */
#activeSlots::-webkit-scrollbar {
    width: 4px;
}
#activeSlots::-webkit-scrollbar-track {
    background: transparent;
}
#activeSlots::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 2px;
}
#activeSlots::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* === INVENTORY GRID (ICONS) === */
#inventorySlots {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* Было 4 -> Стало 5 */
    gap: 10px;
    padding: 10px 5px; /* Небольшой отступ с боков */
    justify-items: center;
    /* Убедимся, что скролл работает */
    overflow-y: auto; 
    min-height: 200px;
}


/* Slot Container - Без анимации появления */
.slot {
    background: transparent;
    border: none;
    width: auto;
    height: auto;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.slot:hover {
    transform: scale(1.05) translateY(-3px);
    filter: brightness(1.2);
}

/* Circular Icon Style */
.slot-icon {
    width: 60px; height: 60px; border-radius: 50%;
    /* Фон делаем темным */
    background: #111;
    border-style: solid;
    border-width: 4px;
    
    display: flex; align-items: center; justify-content: center;
    
    font-size: 28px; font-weight: 900; font-family: 'Arial Black', sans-serif;
    color: inherit;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5), 0 5px 15px rgba(0,0,0,0.3);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    overflow: hidden; /* Предотвращаем выход изображения за границы */
}

.slot-sub {
    font-size: 11px; color: #aaa; font-weight: bold;
    background: rgba(0,0,0,0.8); padding: 2px 5px; border-radius: 4px;
    white-space: nowrap; border: 1px solid #333;
}


/* === MODALS === */
.overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.85); z-index: 100;
    display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px);
    overflow: hidden; /* Убираем скролл на оверлее */
}
.overlay.hidden { display: none; }

.modal-window {
    width: 500px;
    max-width: 95%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 3px solid #2a2a4e;
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.95);
    overflow-x: hidden;
    animation: modalSlideIn 0.3s ease-out forwards;
    /* Адаптивное масштабирование (п. 1.10.1) - использует CSS переменную */
    transform-origin: center center;
    will-change: transform, opacity;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(calc(var(--modal-scale, 1) * 0.95));
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(var(--modal-scale, 1));
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
    margin-bottom: 15px;
    font-weight: 900;
    font-size: 20px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.closeBtn { background: none; color: #ff5555; font-size: 24px; padding: 0 5px; line-height: 1; }
.closeBtn:hover { color: #ff8888; }
.modal-body {
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;
    flex: 1;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 215, 0, 0.3) transparent;
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.3);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.5);
}

/* SETTINGS SLIDERS */
.settings-group { margin-top: 20px; display: flex; flex-direction: column; gap: 18px; }
.volume-control { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: #ccc; }
input[type=range] { -webkit-appearance: none; width: 60%; height: 6px; background: #333; border-radius: 3px; outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #ffd700; cursor: pointer; border: 2px solid #000; }

/* DETAILS MODAL */
#detailPreview {
    font-size: 48px; font-weight: 800; width: 90px; height: 90px;
    border: 4px solid #fff; border-radius: 50%; margin: 10px auto 20px auto;
    display: flex; align-items: center; justify-content: center; background: #222;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}
.detail-stats { text-align: center; color: #ccc; line-height: 1.5; font-size: 14px; }
.flavor-text { color: #777; font-style: italic; font-size: 12px; margin-top: 5px; }
.detail-actions { display: flex; gap: 10px; margin-top: 20px; }
.danger-btn { flex: 1; background: #882222; color: #fff; padding: 12px; } .danger-btn:hover { background: #aa3333; }
.success-btn { flex: 1; background: #228822; color: #fff; padding: 12px; } .success-btn:hover { background: #33aa33; }

/* SHOP & ACH */
.shop-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    padding-bottom: 20px;
    overflow-y: auto;
    max-height: calc(90vh - 120px); /* Оставляем место для заголовка */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.shop-list::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.ach-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 20px;
}

.shop-item {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 12px;
    border-radius: 10px;
    border: 2px solid #2a2a4e;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.shop-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #ffd700, #ffed4a);
    opacity: 0;
    transition: opacity 0.3s;
}

.shop-item:hover {
    transform: translateY(-5px);
    border-color: #ffd700;
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.2);
}

.shop-item:hover::before {
    opacity: 1;
}

.shop-item-maxed {
    opacity: 0.6;
    border-color: #4caf50;
}

/* Бейдж рекомендации */
.shop-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: linear-gradient(135deg, #ffd700, #ffed4a);
    color: #000;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 7px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    z-index: 10;
    line-height: 1.2;
}

/* Заголовок карточки */
.shop-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.shop-icon {
    font-size: 24px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    flex-shrink: 0;
}

.shop-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.shop-name {
    font-weight: bold;
    color: #fff;
    font-size: 12px;
    line-height: 1.2;
}

.shop-desc {
    font-size: 9px;
    color: #888;
    line-height: 1.2;
}

/* Статистика */
.shop-stats {
    display: flex;
    justify-content: space-around;
    padding: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    gap: 6px;
}

.shop-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.stat-label {
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: -0.8px;
    line-height: 1;
    white-space: nowrap;
}

.stat-value {
    font-size: 20px;
    font-weight: bold;
    color: #ffd700;
    line-height: 1;
    white-space: nowrap;
}

.stat-next {
    color: #00ff00;
}

/* Кнопки покупки */
.shop-buttons {
    display: flex;
    gap: 4px;
}

.shop-buy-btn {
    flex: 1;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4a 100%);
    color: #000;
    padding: 6px 2px;
    font-size: 9px;
    font-weight: bold;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
}

.shop-buy-btn:hover {
    background: linear-gradient(135deg, #ffed4a 0%, #fff 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

.shop-buy-btn:active {
    transform: translateY(0);
}

.shop-buy-btn:disabled {
    background: #444;
    color: #777;
    cursor: not-allowed;
    transform: none;
    opacity: 0.5;
}

.shop-buy-max {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
}

.shop-buy-max:hover {
    background: linear-gradient(135deg, #ff8e53 0%, #ffa07a 100%);
}

.shop-buy-max:disabled {
    background: #444;
}

/* ACHIEVEMENTS (CARD STYLE) */
.ach-item {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 12px;
    border-radius: 10px;
    border: 2px solid #2a2a4e;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-height: 50px;
    position: relative;
    overflow: hidden;
}

.ach-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    opacity: 0;
    transition: opacity 0.3s;
}

.ach-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.ach-item:hover::before {
    opacity: 1;
}

.ach-item.locked {
    opacity: 0.6;
    border-color: #2a2a4e;
}

.ach-item.unlocked {
    opacity: 1;
    border-color: #4caf50;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.2);
}

.ach-item.unlocked::before {
    opacity: 1;
}

.ach-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ach-right {
    text-align: right;
}

.ach-name {
    font-weight: bold;
    font-size: 13px;
    color: #fff;
}

.ach-status {
    font-size: 11px;
    font-weight: bold;
}

.status-done {
    color: #4caf50;
}

.status-lock {
    color: #666;
    font-style: italic;
}

.buy-btn { background: #ffd700; color: #000; padding: 6px 14px; font-size: 12px; min-width: 70px; }
.buy-btn:hover { background: #ffed4a; } .buy-btn:disabled { background: #444; color: #777; cursor: not-allowed; }

/* === AD WARNING MODAL === */
#adWarningOverlay {
    background: rgba(0, 0, 0, 0.7) !important; /* Легкое затемнение */
    backdrop-filter: blur(4px);
}

.ad-warning-modal {
    max-width: 100%;
    width: 100%;
    height: 100%;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-warning-modal .modal-body {
    background: transparent !important;
    padding: 40px !important;
    text-align: center;
}

.ad-warning-icon {
    font-size: 96px;
    margin-bottom: 30px;
    animation: pulse 1s infinite;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.5));
}

.ad-warning-title {
    font-size: 36px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 20px;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.ad-warning-message {
    font-size: 24px;
    color: #fff;
    margin-bottom: 40px;
    line-height: 1.5;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.ad-warning-countdown {
    font-size: 72px;
    font-weight: bold;
    color: #00ff00;
    text-shadow: 0 0 30px #00ff00, 0 0 60px #00ff00;
    animation: countdown-pulse 1s infinite;
}

@keyframes countdown-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
}

/* TOAST - Улучшенная анимация */
#toastContainer {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) scale(var(--panel-scale, 1));
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    width: 300px;
    max-width: 90vw; /* Предотвращаем выход за границы экрана (п. 1.10.1) */
    z-index: 10000;
    /* Адаптивное масштабирование (п. 1.10.1) - использует CSS переменную */
    transform-origin: center bottom;
    will-change: transform;
}

.toast {
    background: rgba(20,20,20,0.95);
    border-left: 4px solid gold;
    padding: 12px 16px;
    border-radius: 8px;
    color: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5), 0 0 20px rgba(255, 215, 0, 0.2);
    animation: toastBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    backdrop-filter: blur(8px);
}

/* BOTTOM BUTTONS */
.bottom-right {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 20;
    transform-origin: bottom right;
    transition: transform 0.15s ease-out;
    will-change: transform;
}
.lang-buttons { display: flex; gap: 10px; justify-content: center; }
.lang-buttons button { background: #333; color: #fff; padding: 8px 20px; border: 1px solid #555; }
.lang-buttons button:hover { border-color: #888; background: #444; }

/* AUTO SELL GRID */
.autosell-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.autosell-grid .menu-btn {
    padding: 8px 4px;
    font-size: 11px;
    min-width: auto;
    white-space: nowrap;
}

/* === STYLES FOR IMAGES === */

/* Глобальный запрет выделения и перетаскивания изображений */
img {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    pointer-events: none; /* Полностью отключаем взаимодействие */
    -webkit-tap-highlight-color: transparent;
}

/* ЗАМЕНА IMG НА BACKGROUND-IMAGE ДЛЯ ПРЕДОТВРАЩЕНИЯ КОНТЕКСТНОГО МЕНЮ */

/* АГРЕССИВНАЯ ЗАЩИТА ОТ КОНТЕКСТНОГО МЕНЮ ДЛЯ ВСЕХ card-image */
.card-image {
    pointer-events: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    -webkit-touch-callout: none !important;
    -webkit-user-drag: none !important;
    user-drag: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Картинка внутри слота (инвентарь/активные) - теперь через background */
.slot-icon .card-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Картинка на главной карте (Roll) - теперь через background */
.mystery-card .card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1;
}

/* Картинка в модальном окне (Детали) - теперь через background */
#detailPreview .card-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Картинка в альбоме - теперь через background */
.album-icon .card-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Класс для скрытия элементов */
.hidden {
    display: none !important;
}

/* AUTO ROLL BUTTON */
.auto-btn {
    background: #333;
    color: #888;
    border: 1px solid #555;
    padding: 6px;
    font-size: 10px;
    width: 100%; /* Растягиваем под ширину родителя (rollBtn) */
    text-transform: uppercase;
    letter-spacing: 1px;
}

.auto-btn.active {
    background: #00aa00; /* Зеленый когда активна */
    color: #fff;
    border-color: #00ff00;
    box-shadow: 0 0 10px #00ff00;
}

/* Второстепенная кнопка (Sell All) */
.sub-action-btn {
    width: 100%;
    background: transparent;
    color: #666;
    border: 1px solid #333;
    padding: 8px 0;
    font-size: 11px;
    border-radius: 6px;
    transition: 0.2s;
}

.sub-action-btn:hover {
    background: #252525;
    color: #aaa;
    border-color: #555;
}

/* Модальное окно шире для ачивок */
#achievementsOverlay .modal-window {
    width: 600px; /* Широкое окно */
    max-width: 95%;
}

/* Сетка для списка ачивок (2 колонки) */
.ach-list {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Две равные колонки */
    gap: 10px;
    padding-bottom: 20px;
}

/* Заголовки категорий должны занимать всю ширину */
.ach-header {
    grid-column: span 2; /* Растянуть на обе колонки */
    color: #888;
    font-size: 11px;
    margin-top: 15px;
    border-bottom: 1px solid #333;
    text-transform: uppercase;
    padding-bottom: 5px;
    font-weight: bold;
    letter-spacing: 1px;
}

/* Сами плашки ачивок */
.ach-item {
    background: #181818;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    min-height: 36px;
}

/* === STATISTICS MODAL (IMPROVED CARD STYLE) === */
.stats-body {
    padding: 15px 10px;
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-card {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #2a2a4e;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ffd700, #ffed4a);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: #ffd700;
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.3);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:hover .stat-value {
    transform: scale(1.08);
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 4px;
    filter: drop-shadow(0 2px 8px rgba(255, 215, 0, 0.3));
    transition: all 0.3s;
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 4px 12px rgba(255, 215, 0, 0.6));
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-card .stat-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    line-height: 1.1;
    letter-spacing: -0.5px;
    transition: all 0.3s;
}

/* Welcome Bonus Modal */
.welcome-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 3000; /* Поверх всего */
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.welcome-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 3px solid #ffd700;
    border-radius: 20px;
    padding: 40px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(255, 215, 0, 0.5), 0 0 100px rgba(255, 215, 0, 0.3);
    position: relative;
    overflow: hidden;
    animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Адаптивное масштабирование (п. 1.10.1) - использует CSS переменную */
    transform: scale(var(--modal-scale, 1));
    transform-origin: center center;
    will-change: transform;
}

.welcome-content::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 215, 0, 0.15), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

@keyframes scaleIn {
    from { transform: scale(calc(var(--modal-scale, 1) * 0.5)); opacity: 0; }
    to { transform: scale(var(--modal-scale, 1)); opacity: 1; }
}

.welcome-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounceRotate 1.5s infinite;
    filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.8));
    position: relative;
    z-index: 1;
}

@keyframes bounceRotate {
    0%, 100% { transform: translateY(0) rotate(-10deg); }
    50% { transform: translateY(-15px) rotate(10deg); }
}

.welcome-title {
    font-size: 32px;
    font-weight: 900;
    color: #ffd700;
    margin-bottom: 15px;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
    position: relative;
    z-index: 1;
}

.welcome-text {
    font-size: 16px;
    color: #ddd;
    margin-bottom: 15px;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.welcome-bonus {
    font-size: 48px;
    font-weight: 900;
    color: #ffd700;
    margin: 20px 0;
    text-shadow: 0 0 40px rgba(255, 215, 0, 1);
    animation: pulse 1.5s infinite;
    position: relative;
    z-index: 1;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); text-shadow: 0 0 40px rgba(255, 215, 0, 1); }
    50% { transform: scale(1.15); text-shadow: 0 0 60px rgba(255, 215, 0, 1); }
}

.welcome-btn {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4a 100%);
    color: #000;
    border: none;
    padding: 16px 48px;
    font-size: 18px;
    font-weight: 900;
    border-radius: 12px;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 0 6px 0 #b29600, 0 10px 30px rgba(255, 215, 0, 0.5);
    transition: all 0.1s;
    position: relative;
    z-index: 1;
    animation: btnGlow 2s infinite;
}

@keyframes btnGlow {
    0%, 100% { box-shadow: 0 6px 0 #b29600, 0 10px 30px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 6px 0 #b29600, 0 10px 40px rgba(255, 215, 0, 0.9); }
}

.welcome-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 9px 0 #b29600, 0 15px 50px rgba(255, 215, 0, 1);
}

.welcome-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #b29600, 0 5px 15px rgba(255, 215, 0, 0.4);
}

/* === DAILY REWARDS (CARD STYLE) === */
.daily-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.daily-item {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #2a2a4e;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    opacity: 0.5;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-height: 90px;
    cursor: default;
    position: relative;
    overflow: hidden;
}

.daily-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #ffd700, #ffed4a);
    opacity: 0;
    transition: opacity 0.3s;
}

/* Последний элемент (7 день) */
.daily-item:last-child {
    grid-column: span 4;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), #16213e);
    border-color: rgba(255, 215, 0, 0.4);
}

.daily-item.active {
    opacity: 1;
    border-color: #ffd700;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), #16213e);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.4);
    transform: translateY(-5px) scale(1.05);
    cursor: pointer;
    z-index: 10;
}

.daily-item.active::before {
    opacity: 1;
}

.daily-item.claimed {
    opacity: 0.7;
    border-color: #4caf50;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.15), #16213e);
}

.daily-item.claimed::before {
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    opacity: 1;
}

.daily-day {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
}

.daily-reward {
    font-size: 14px;
    font-weight: bold;
    color: #ffd700;
}

.daily-icon {
    font-size: 24px;
    margin: 5px 0;
}

.daily-status {
    text-align: center;
    color: #888;
    font-size: 12px;
    margin-top: 10px;
}

/* === QUESTS (CARD STYLE) === */
.quests-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quest-item {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #2a2a4e;
    border-radius: 10px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.quest-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    opacity: 0;
    transition: opacity 0.3s;
}

.quest-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.quest-item:hover::before {
    opacity: 1;
}

.quest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quest-title {
    font-weight: bold;
    color: #fff;
    font-size: 14px;
}

.quest-reward {
    color: #ffd700;
    font-size: 12px;
    font-weight: bold;
    background: rgba(255, 215, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.quest-progress-bar {
    height: 6px;
    background: #333;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.quest-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50 0%, #8bc34a 50%, #4caf50 100%);
    background-size: 200% 100%;
    animation: progressShine 2s linear infinite;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.quest-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent);
    animation: progressGlide 1.5s ease-in-out infinite;
}

.quest-progress-text {
    font-size: 10px;
    color: #888;
    text-align: right;
    margin-top: 2px;
}

.quest-claim-btn {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4a 100%);
    color: #000;
    border: none;
    padding: 8px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 5px;
    width: 100%;
    text-transform: uppercase;
    font-size: 12px;
}

.quest-claim-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.3);
}

.quests-timer {
    text-align: center;
    color: #888;
    font-size: 12px;
    margin-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
}

/* === ALBUM (CARD STYLE) - УЛУЧШЕННЫЙ ДЛЯ ДЕСКТОПА === */
.album-modal .modal-window {
    width: 750px;
    max-width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.album-modal .modal-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
}

.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 16px;
    padding: 16px 12px;
    max-height: calc(90vh - 100px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 215, 0, 0.4) transparent;
}

.album-grid::-webkit-scrollbar {
    width: 8px;
}

.album-grid::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.album-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.4);
    border-radius: 4px;
}

.album-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.6);
}

.album-item {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #2a2a4e;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.4;
    filter: grayscale(1);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    min-height: 140px;
    animation: albumCardFadeIn 0.4s ease-out backwards;
}

@keyframes albumCardFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Задержка анимации для каждой карточки */
.album-item:nth-child(1) { animation-delay: 0.05s; }
.album-item:nth-child(2) { animation-delay: 0.1s; }
.album-item:nth-child(3) { animation-delay: 0.15s; }
.album-item:nth-child(4) { animation-delay: 0.2s; }
.album-item:nth-child(5) { animation-delay: 0.25s; }
.album-item:nth-child(6) { animation-delay: 0.3s; }
.album-item:nth-child(7) { animation-delay: 0.35s; }
.album-item:nth-child(8) { animation-delay: 0.4s; }

.album-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    opacity: 0;
    transition: opacity 0.3s;
}

.album-item.unlocked {
    opacity: 1;
    filter: grayscale(0);
    border-color: currentColor;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.album-item.unlocked::before {
    background: linear-gradient(90deg, currentColor, currentColor);
    opacity: 1;
}

.album-item.unlocked:hover {
    transform: translateY(-8px) scale(1.08);
    box-shadow: 0 12px 35px currentColor;
}

.album-icon {
    width: 100%;
    aspect-ratio: 3/4;
    border-radius: 10px;
    background: #0f0f1a;
    border: 3px solid #2a2a4e;
    overflow: hidden;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.6), 0 4px 12px rgba(0, 0, 0, 0.5);
    transition: all 0.3s;
    position: relative;
}

.album-item.unlocked .album-icon {
    border-color: currentColor;
    box-shadow: 0 0 25px currentColor, inset 0 0 15px rgba(0,0,0,0.4);
}

.album-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.album-name {
    font-size: 11px;
    text-align: center;
    color: #888;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
}

.album-item.unlocked .album-name {
    color: #fff;
    font-size: 12px;
    text-shadow: 0 0 10px currentColor;
}

.album-section-header {
    grid-column: 1 / -1;
    font-size: 14px;
    color: #fff;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
    padding: 12px 8px 8px 8px;
    margin-top: 20px;
    margin-bottom: 12px;
    text-transform: uppercase;
    font-weight: 900;
    letter-spacing: 2px;
    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.8);
    background: linear-gradient(to bottom, rgba(255, 215, 0, 0.15), transparent);
    border-radius: 6px 6px 0 0;
}

/* === CARD SHEEN EFFECT === */
.mystery-card {
    /* ... existing styles ... */
    transform-style: preserve-3d; /* Для 3D эффекта */
    transition: transform 0.1s ease-out; /* Плавность наклона */
}

.mystery-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: skewX(-25deg);
    animation: sheen 3s infinite;
    pointer-events: none;
    z-index: 5;
}

/* Boost Active Effect */
.boost-active {
    color: #00ff00 !important;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.6);
    border-color: #00ff00 !important;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.3) !important;
}

.boost-text {
    color: #00ff00;
    font-weight: bold;
    animation: pulseText 1s infinite;
}

@keyframes pulseText {
    0% { opacity: 0.8; }
    50% { opacity: 1; text-shadow: 0 0 5px #00ff00; }
    100% { opacity: 0.8; }
}

@keyframes sheen {
    0% { left: -100%; }
    20% { left: 200%; }
    100% { left: 200%; }
}

/* Result Text Fade Out */
#result {
    transition: opacity 0.5s ease-out;
    min-height: 24px; /* Prevent layout shift */
}
#result.fade-out {
    opacity: 0;
}

/* === MOBILE DEVICE CLASS STYLES (более надежно чем media query) === */
body.mobile-device * {
    transform-style: flat !important;
    perspective: none !important;
}

body.mobile-device .mystery-card {
    width: 140px !important;
    height: 210px !important;
    transform: none !important;
}

body.mobile-device .coins-display {
    font-size: 20px !important;
}

body.mobile-device .action-btn {
    width: 75px !important;
    height: 40px !important;
    font-size: 10px !important;
    box-shadow: 0 4px 0 #000 !important;
}

body.mobile-device #rollBtn {
    width: 75px !important;
    height: 40px !important;
    font-size: 10px !important;
    box-shadow: 0 4px 0 #b29600, 0 0 15px rgba(255, 215, 0, 0.3) !important;
}

body.mobile-device .roll-group {
    width: 75px !important;
}

body.mobile-device .menu-btn {
    padding: 8px 12px !important;
    font-size: 11px !important;
    min-width: 80px !important;
}

body.mobile-device .top-left-panel {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 2px !important;
    padding: 3px !important;
}

body.mobile-device .active-panel {
    left: 5px !important;
    width: 55px !important;
}

body.mobile-device .active-panel .slot-icon {
    width: 38px !important;
    height: 38px !important;
    font-size: 16px !important;
}

body.mobile-device .game {
    gap: 5px !important;
}

body.mobile-device .controls {
    gap: 8px !important;
}

/* === MOBILE RESPONSIVE STYLES === */
@media (max-width: 600px) {
    /* Улучшенное модальное окно для мобильных */
    .modal-window {
        width: 92%;
        padding: 16px;
        max-height: 85vh;
        margin: 7.5vh auto;
        border-radius: 20px;
        border-width: 3px;
        box-shadow: 0 25px 70px rgba(0, 0, 0, 0.95);
        animation: modalSlideIn 0.3s ease-out;
    }
    
    @keyframes modalSlideIn {
        from {
            opacity: 0;
            transform: translateY(-30px) scale(0.95);
        }
        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }
    
    .modal-body {
        overflow-y: auto;
        overflow-x: hidden;
        flex: 1;
        min-height: 0;
        max-height: calc(85vh - 80px);
        -webkit-overflow-scrolling: touch;
        padding: 12px 8px 24px 8px;
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 215, 0, 0.3) transparent;
    }
    
    .modal-body::-webkit-scrollbar {
        width: 6px;
    }
    
    .modal-body::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .modal-body::-webkit-scrollbar-thumb {
        background: rgba(255, 215, 0, 0.3);
        border-radius: 3px;
    }
    
    .modal-header {
        font-size: 13px !important;
        padding: 12px 8px;
        margin-bottom: 8px;
        letter-spacing: 1px;
        text-transform: uppercase;
        font-weight: 700;
        border-bottom: 2px solid rgba(255, 215, 0, 0.2);
    }
    
    /* Улучшенная кнопка закрытия */
    .closeBtn {
        font-size: 18px;
        width: 36px;
        height: 36px;
        line-height: 34px;
        border-radius: 50%;
        background: rgba(255, 0, 0, 0.1);
        transition: all 0.2s ease;
        font-weight: bold;
    }
    
    .closeBtn:active {
        transform: scale(0.9);
        background: rgba(255, 0, 0, 0.2);
    }
    
    /* Улучшенные кнопки действий для мобильных */
    .detail-actions {
        display: flex;
        gap: 12px;
        margin-top: 16px;
        padding-top: 12px;
        border-top: 1px solid rgba(255, 215, 0, 0.1);
    }
    
    .detail-actions button {
        font-size: 14px;
        padding: 14px 20px;
        margin: 0;
        flex: 1;
        min-height: 48px;
        border-radius: 12px;
        font-weight: 600;
        letter-spacing: 0.5px;
        transition: all 0.2s ease;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    .detail-actions button:active {
        transform: scale(0.96);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    }
    
    .success-btn {
        background: linear-gradient(135deg, #00d084 0%, #00a86b 100%);
    }
    
    .success-btn:active {
        background: linear-gradient(135deg, #00a86b 0%, #008556 100%);
    }
    
    .danger-btn {
        background: linear-gradient(135deg, #ff4757 0%, #d63447 100%);
    }
    
    .danger-btn:active {
        background: linear-gradient(135deg, #d63447 0%, #b82e3a 100%);
    }
    
    /* Улучшенное сообщение модального окна */
    #customModalMessage {
        font-size: 15px;
        line-height: 1.6;
        padding: 12px 8px;
        color: rgba(255, 255, 255, 0.95);
        text-align: center;
        font-weight: 500;
    }
    
    /* Отключаем 3D эффект на мобильных для карты */
    .mystery-card {
        transform: none !important;
        transform-style: flat !important;
    }
    
    /* КРИТИЧЕСКИ ВАЖНО: Полностью отключаем все transform для кнопок */
    #rollBtn,
    .action-btn,
    button,
    #tapBtn,
    #autoRollBtn,
    .menu-btn,
    .roll-group button {
        transform: none !important;
        transform-style: flat !important;
        perspective: none !important;
    }
    
    /* Отключаем hover эффекты с transform */
    #rollBtn:hover,
    .action-btn:hover,
    button:hover {
        transform: none !important;
    }
    
    /* Только для active состояния разрешаем небольшой сдвиг вниз */
    #rollBtn:active,
    .action-btn:active,
    button:active {
        transform: translateY(2px) !important;
    }
    
    /* 1. Top Navigation Bar */
    .top-left-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 45px; /* Оставляем место для кнопки настроек */
        padding: 3px;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 2px;
        justify-content: flex-start;
        background: linear-gradient(to bottom, rgba(0,0,0,0.95), transparent);
        z-index: 99; /* Ниже кнопки настроек */
    }
    
    .top-left-panel::-webkit-scrollbar { display: none; }

    .menu-btn {
        padding: 8px 12px;
        font-size: 11px;
        min-width: 80px;
        flex: 0 0 auto;
        white-space: nowrap;
        border-radius: 6px;
    }

    /* Settings button - расположена слева, выше панели активных предметов */
    .top-right-panel {
        position: fixed;
        top: 80px; /* Фиксированная позиция ниже верхних кнопок */
        left: 5px;
        right: auto;
        z-index: 101; /* Выше всех элементов */
    }
    
    .top-right-panel .menu-btn {
        padding: 8px;
        font-size: 16px;
        min-width: auto;
        width: 30px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
        background: rgba(26, 26, 26, 0.95) !important;
        border-radius: 6px; /* Квадратная кнопка со скругленными углами */
    }
    
    body:has(.overlay:not(.hidden)) .top-right-panel {
        display: none;
    }

    /* 2. Game Area Adjustments */
    .game {
        position: fixed;
        width: 100%;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        gap: 5px;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        flex-wrap: nowrap;
    }

    /* Coins under card */
    .coins-display {
        position: static;
        text-align: center;
        font-size: 20px;
        z-index: 90;
        pointer-events: none;
        text-shadow: 0 2px 8px rgba(0,0,0,0.8);
        order: 2;
        margin: 0;
        width: 100%;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mystery-card {
        width: 140px;
        height: 210px;
        overflow: hidden;
        order: 1;
        flex-shrink: 0;
        border-radius: 12px;
        border-width: 2px;
    }

    .mystery-card img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 10px;
    }

    #rollText {
        font-size: 60px;
    }
    
    #rollRarity {
        font-size: 9px;
        padding: 3px 6px;
        margin-bottom: 12px;
        letter-spacing: 0.5px;
    }

    /* 3. Controls Scaling - ИСПРАВЛЕНИЕ БАГА */
    .controls {
        position: static;
        gap: 8px;
        width: auto;
        justify-content: center;
        order: 3;
        margin-top: 5px;
        display: flex;
        flex-direction: row;
        align-items: flex-start;
    }

    .action-btn {
        width: 75px;
        height: 40px;
        font-size: 10px;
        box-shadow: 0 4px 0 #000;
        transform: none !important;
    }
    
    .action-btn:active {
        transform: translateY(2px) !important;
        box-shadow: 0 2px 0 #000;
    }

    #rollBtn {
        box-shadow: 0 4px 0 #b29600, 0 0 15px rgba(255, 215, 0, 0.3);
    }
    
    #rollBtn:hover {
        box-shadow: 0 4px 0 #b29600, 0 0 20px rgba(255, 215, 0, 0.4);
        transform: none !important;
    }
    
    #rollBtn:active {
        box-shadow: 0 4px 0 #b29600; /* Оставляем тень без изменений */
        transform: none !important; /* Полностью убираем движение */
    }

    .roll-group {
        width: 75px;
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
    
    .auto-btn {
        padding: 4px 0;
        font-size: 9px;
    }

    /* 4. Active Panel (Left Vertical Column) - ОПТИМИЗИРОВАННЫЙ */
    .active-panel {
        position: fixed;
        top: 50%;
        bottom: auto;
        right: auto;
        left: 5px;
        transform: translateY(-50%);
        width: 55px;
        height: auto;
        max-height: 60vh;
        flex-direction: column;
        padding: 6px 4px;
        overflow-y: auto;
        overflow-x: hidden;
        justify-content: flex-start;
        align-items: center;
        white-space: normal;
        background: rgba(0,0,0,0.95);
        border-radius: 10px;
        border: 1px solid #444;
        z-index: 80;
    }

    .active-panel h3 {
        writing-mode: vertical-rl;
        transform: rotate(180deg);
        margin: 0 0 6px 0;
        font-size: 8px;
        border-right: none;
        border-bottom: 1px solid #444;
        padding-right: 0;
        padding-bottom: 5px;
        display: block;
        min-width: auto;
        text-align: center;
        color: #888;
    }

    #activeSlots {
        display: flex;
        flex-direction: column;
        gap: 6px;
        align-items: center;
    }

    .active-panel .slot {
        transform: none;
        margin: 0;
    }
    
    .active-panel .slot-icon {
        width: 38px;
        height: 38px;
        font-size: 16px;
        border-width: 2px;
    }
    
    .active-panel .slot-icon img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .active-panel .slot-sub {
        font-size: 7px;
        padding: 1px 3px;
        margin-top: 2px;
    }

    /* 5. Bottom Navigation Bar */
    .bottom-right {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        justify-content: space-around;
        width: 100%;
        gap: 0;
        padding: 4px 2px;
        background: rgba(17, 17, 17, 0.95);
        border-top: 1px solid #333;
        z-index: 90;
    }

    .bottom-right .menu-btn {
        flex: 1;
        margin: 0 2px;
        border-radius: 6px;
        padding: 10px 4px;
        font-size: 11px;
    }

    /* 6. Modals Adaptation - УДАЛЕНО (уже определено выше) */
    
    /* Глобальное уменьшение всех текстов в модалках */
    .modal-body {
        font-size: 10px;
    }
    
    .modal-body h1, .modal-body h2, .modal-body h3 {
        font-size: 12px !important;
    }
    
    .modal-body h4, .modal-body h5, .modal-body h6 {
        font-size: 10px !important;
    }
    
    .modal-body p, .modal-body div, .modal-body span {
        font-size: 10px !important;
    }
    
    .modal-body button {
        font-size: 9px !important;
        padding: 5px 8px !important;
    }

    #inventorySlots {
        grid-template-columns: repeat(5, 1fr);
        gap: 4px;
        padding: 5px 3px;
    }
    
    .slot {
        gap: 3px;
    }
    
    .slot-icon {
        width: 32px !important;
        height: 32px !important;
        font-size: 13px !important;
        border-width: 2px !important;
    }
    
    .slot-icon img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }
    
    .slot-sub {
        font-size: 6px !important;
        padding: 1px 2px !important;
    }

    /* Магазин */
    .shop-list {
        grid-template-columns: 1fr;
        gap: 8px;
        max-height: none; /* Убираем ограничение, скролл на modal-body */
        padding-bottom: 30px;
        overflow-y: visible; /* Скролл управляется родителем */
    }
    
    /* Специальные стили для модалки магазина */
    #shopOverlay .modal-window {
        max-height: 80vh;
        margin: 10vh auto;
    }
    
    #shopOverlay .modal-body {
        max-height: calc(80vh - 50px);
        overflow-y: scroll !important;
        -webkit-overflow-scrolling: touch;
        padding-right: 5px;
        padding-bottom: 30px;
    }
    
    .shop-item h3, .shop-item h4 {
        font-size: 9px !important;
    }
    
    .ach-list {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    
    .shop-item {
        padding: 8px;
        gap: 5px;
        min-height: auto;
        overflow: visible;
    }
    
    .shop-card-header {
        gap: 6px;
    }
    
    .shop-icon {
        font-size: 18px;
    }
    
    .shop-name {
        font-size: 12px !important;
    }
    
    .shop-desc {
        font-size: 9px !important;
    }
    
    .shop-stats {
        padding: 5px;
        gap: 4px;
        display: flex !important;
    }
    
    .shop-stat {
        display: flex !important;
        flex-direction: column !important;
    }
    
    .stat-label {
        font-size: 10px !important;
        letter-spacing: 0.1px;
    }
    
    .stat-value {
        font-size: 14px !important;
    }
    
    .shop-buttons {
        gap: 4px;
        display: flex !important;
        margin-top: 5px;
    }
    
    .shop-buy-btn {
        padding: 8px 4px !important;
        font-size: 10px !important;
        line-height: 1.2;
        min-height: 34px;
        flex: 1;
    }
    
    .shop-badge {
        font-size: 7px !important;
        padding: 2px 4px;
    }
    
    .ach-item {
        padding: 4px 5px;
        min-height: 24px;
    }
    
    .ach-name {
        font-size: 8px !important;
    }
    
    .ach-status {
        font-size: 6px !important;
    }
    
    .ach-header {
        font-size: 8px !important;
    }

    .daily-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 3px;
        margin-bottom: 8px;
    }
    
    .daily-item {
        padding: 4px;
        min-height: 40px;
        gap: 2px;
    }
    
    .daily-item:last-child {
        grid-column: span 3;
    }
    
    .daily-day {
        font-size: 6px !important;
    }
    
    .daily-reward {
        font-size: 8px !important;
    }
    
    .daily-icon {
        font-size: 12px;
        margin: 1px 0;
    }
    
    .daily-status {
        font-size: 8px !important;
        margin-top: 5px;
    }
    
    /* === УЛУЧШЕННЫЕ СТИЛИ АЛЬБОМА ДЛЯ МОБИЛЬНЫХ === */
    .album-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 10px;
        padding: 12px 8px;
        max-height: calc(85vh - 120px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .album-item {
        padding: 8px;
        gap: 6px;
        border-radius: 8px;
        transition: all 0.3s ease;
        min-height: 110px;
        cursor: pointer;
    }
    
    .album-item:active {
        transform: scale(0.95);
        background: linear-gradient(135deg, #1f1f3e 0%, #1a1a3e 100%);
    }
    
    .album-item.unlocked:active {
        transform: scale(0.98);
    }
    
    .album-icon {
        width: 100%;
        aspect-ratio: 3/4;
        border-width: 2px;
        border-radius: 6px;
        transition: all 0.3s ease;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    }
    
    .album-item.unlocked .album-icon {
        box-shadow: 0 4px 12px currentColor;
    }
    
    .album-icon img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 4px;
    }
    
    .album-name {
        font-size: 9px !important;
        line-height: 1.2;
        font-weight: 700;
        text-align: center;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        max-width: 100%;
    }
    
    .album-item.unlocked .album-name {
        font-size: 10px !important;
        text-shadow: 0 0 8px currentColor;
    }
    
    .album-section-header {
        font-size: 11px !important;
        padding: 8px 4px 6px 4px;
        margin-top: 12px;
        margin-bottom: 8px;
        border-bottom: 2px solid rgba(255, 215, 0, 0.3);
        text-transform: uppercase;
        font-weight: 900;
        letter-spacing: 1.5px;
        text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
        background: linear-gradient(to bottom, rgba(255, 215, 0, 0.1), transparent);
        border-radius: 4px 4px 0 0;
    }
    
    /* Улучшенный скроллбар для альбома */
    .album-grid::-webkit-scrollbar {
        width: 6px;
    }
    
    .album-grid::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.3);
        border-radius: 3px;
    }
    
    .album-grid::-webkit-scrollbar-thumb {
        background: rgba(255, 215, 0, 0.4);
        border-radius: 3px;
    }
    
    .album-grid::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 215, 0, 0.6);
    }
    
    /* Специальная модалка альбома на мобильных */
    .album-modal .modal-window {
        max-height: 90vh;
        display: flex;
        flex-direction: column;
    }
    
    .album-modal .modal-body {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 0;
    }
    
    /* Анимация появления карточек */
    .album-item {
        animation: albumCardFadeIn 0.3s ease-out backwards;
    }
    
    @keyframes albumCardFadeIn {
        from {
            opacity: 0;
            transform: translateY(10px) scale(0.9);
        }
        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }
    
    /* Задержка анимации для каждой карточки */
    .album-item:nth-child(1) { animation-delay: 0.05s; }
    .album-item:nth-child(2) { animation-delay: 0.1s; }
    .album-item:nth-child(3) { animation-delay: 0.15s; }
    .album-item:nth-child(4) { animation-delay: 0.2s; }
    .album-item:nth-child(5) { animation-delay: 0.25s; }
    .album-item:nth-child(6) { animation-delay: 0.3s; }
    
    .top-left-panel {
        padding-right: 3px;
    }
    
    .click-particle {
        font-size: 12px;
        z-index: 200;
    }
    
    .particle-crit {
        font-size: 16px;
    }
    
    .particle-boost {
        font-size: 14px;
    }
    
    #result {
        font-size: 9px;
    }
    
    /* Toast notifications */
    #toastContainer {
        bottom: 50px;
        width: 90%;
        max-width: 280px;
    }
    
    .toast {
        padding: 8px 12px;
        font-size: 11px;
        border-radius: 6px;
    }
    
    /* Статистика */
    .stat-grid {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    
    .stat-card {
        padding: 5px;
        gap: 3px;
    }
    
    .stat-icon {
        font-size: 14px;
        margin-bottom: 1px;
    }
    
    .stat-card .stat-label {
        font-size: 6px !important;
        letter-spacing: 0.1px !important;
        line-height: 1 !important;
    }
    
    .stat-card .stat-value {
        font-size: 11px !important;
        line-height: 1 !important;
    }
    
    .stats-body {
        padding: 8px 4px;
    }
    
    /* Квесты */
    .quests-list {
        gap: 6px;
    }
    
    .quest-item {
        padding: 5px;
        gap: 4px;
    }
    
    .quest-title {
        font-size: 9px !important;
    }
    
    .quest-reward {
        font-size: 7px !important;
        padding: 2px 3px;
    }
    
    .quest-progress-bar {
        height: 3px;
    }
    
    .quest-progress-text {
        font-size: 6px !important;
        margin-top: 1px;
    }
    
    .quest-claim-btn {
        padding: 4px;
        font-size: 7px !important;
        margin-top: 2px;
    }
    
    .quests-timer {
        font-size: 8px !important;
        margin-top: 8px;
        padding-top: 6px;
    }
} /* Конец @media (max-width: 768px) для основных мобильных стилей */

/* === PRESTIGE SYSTEM === */
.prestige-modal .modal-window {
    width: 600px;
    max-width: 95%;
    background: linear-gradient(135deg, #2a1a4e 0%, #1a1a3e 100%);
    border: 3px solid #ffd700;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.5);
    overflow-x: hidden; /* Убираем горизонтальный скролл */
}

.prestige-content {
    text-align: center;
    padding: 20px;
    overflow-x: hidden; /* Убираем горизонтальный скролл */
}

.prestige-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounceRotate 2s infinite;
    filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.8));
}

.prestige-title {
    font-size: 32px;
    font-weight: 900;
    color: #ffd700;
    margin-bottom: 15px;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
}

.prestige-info {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.prestige-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.prestige-stat:last-child {
    border-bottom: none;
}

.prestige-label {
    font-size: 14px;
    color: #aaa;
}

.prestige-value {
    font-size: 18px;
    font-weight: bold;
    color: #ffd700;
}

.prestige-multiplier {
    font-size: 48px;
    font-weight: 900;
    color: #ffd700;
    margin: 20px 0;
    text-shadow: 0 0 40px rgba(255, 215, 0, 1);
    animation: pulse 2s infinite;
    word-wrap: break-word; /* Перенос длинного текста */
}

.prestige-warning {
    color: #ff6b6b;
    font-size: 14px;
    margin: 15px 0;
    padding: 10px;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 6px;
    word-wrap: break-word; /* Перенос длинного текста */
    overflow-wrap: break-word;
}

.prestige-buttons {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.prestige-btn {
    flex: 1;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4a 100%);
    color: #000;
    border: none;
    padding: 16px;
    font-size: 18px;
    font-weight: 900;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 6px 0 #b29600, 0 10px 30px rgba(255, 215, 0, 0.5);
    transition: all 0.1s;
}

.prestige-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 9px 0 #b29600, 0 15px 50px rgba(255, 215, 0, 1);
}

.prestige-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #b29600, 0 5px 15px rgba(255, 215, 0, 0.4);
}

.prestige-btn.cancel {
    background: #444;
    color: #fff;
    box-shadow: 0 6px 0 #222, 0 10px 30px rgba(0, 0, 0, 0.5);
}

.prestige-btn.cancel:hover {
    background: #555;
    box-shadow: 0 9px 0 #222, 0 15px 50px rgba(0, 0, 0, 0.7);
}

.prestige-indicator {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.95), rgba(255, 237, 74, 0.95));
    color: #000;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    z-index: 150;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.5);
    animation: pulseGlow 2s infinite;
}

/* === LEADERBOARD === */
.leaderboard-modal .modal-window {
    width: 600px;
    max-width: 95%;
}

.leaderboard-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #333;
}

.leaderboard-tab {
    flex: 1;
    background: transparent;
    color: #888;
    border: none;
    padding: 12px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.leaderboard-tab:hover {
    color: #aaa;
    background: rgba(255, 255, 255, 0.05);
}

.leaderboard-tab.active {
    color: #ffd700;
    border-bottom-color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 500px;
    overflow-y: auto;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s;
}

.leaderboard-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(5px);
}

.leaderboard-item.current-player {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.leaderboard-rank {
    font-size: 20px;
    font-weight: 900;
    color: #666;
    min-width: 40px;
    text-align: center;
}

.leaderboard-rank.top1 { color: #ffd700; text-shadow: 0 0 10px #ffd700; }
.leaderboard-rank.top2 { color: #c0c0c0; text-shadow: 0 0 10px #c0c0c0; }
.leaderboard-rank.top3 { color: #cd7f32; text-shadow: 0 0 10px #cd7f32; }

.leaderboard-player {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.leaderboard-name {
    font-size: 14px;
    font-weight: bold;
    color: #fff;
}

.leaderboard-score {
    font-size: 18px;
    font-weight: 900;
    color: #ffd700;
}

.leaderboard-loading {
    text-align: center;
    padding: 40px;
    color: #888;
    font-size: 14px;
}

.leaderboard-error {
    text-align: center;
    padding: 40px;
    color: #ff6b6b;
    font-size: 14px;
}

/* === TUTORIAL OVERLAY === */
.tutorial-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.tutorial-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #ffd700;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(255, 215, 0, 0.3);
    position: relative;
    /* Адаптивное масштабирование (п. 1.10.1) - использует CSS переменную */
    transform: scale(var(--modal-scale, 1));
    transform-origin: center center;
    will-change: transform;
}

.tutorial-step {
    display: none;
}

.tutorial-step.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

.tutorial-icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.tutorial-title {
    font-size: 24px;
    font-weight: 900;
    color: #ffd700;
    margin-bottom: 15px;
}

.tutorial-text {
    font-size: 16px;
    color: #ddd;
    line-height: 1.6;
    margin-bottom: 25px;
}

.tutorial-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.tutorial-btn {
    background: #ffd700;
    color: #000;
    border: none;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.tutorial-btn:hover {
    background: #ffed4a;
    transform: translateY(-2px);
}

.tutorial-btn.skip {
    background: #444;
    color: #fff;
}

.tutorial-btn.skip:hover {
    background: #555;
}

.tutorial-progress {
    margin-top: 20px;
    font-size: 12px;
    color: #888;
}

/* === MOBILE RESPONSIVE ADDITIONS === */
@media (max-width: 768px) {
    .prestige-modal .modal-window,
    .leaderboard-modal .modal-window {
        width: 95%;
        padding: 15px 10px;
    }
    
    .prestige-content {
        padding: 15px;
    }
    
    .prestige-icon {
        font-size: 50px;
        margin-bottom: 15px;
    }
    
    .prestige-title {
        font-size: 18px !important;
        margin-bottom: 10px;
    }
    
    .prestige-info {
        padding: 12px;
        margin: 12px 0;
    }
    
    .prestige-stat {
        padding: 6px 0;
    }
    
    .prestige-label {
        font-size: 10px !important;
    }
    
    .prestige-value {
        font-size: 12px !important;
    }
    
    .prestige-multiplier {
        font-size: 24px !important;
        margin: 10px 0;
    }
    
    .prestige-warning {
        font-size: 10px !important;
        margin: 8px 0;
        padding: 6px;
    }
    
    .prestige-buttons {
        flex-direction: column;
        gap: 8px;
        margin-top: 15px;
    }
    
    .prestige-btn {
        padding: 10px;
        font-size: 12px !important;
    }
    
    .leaderboard-tabs {
        flex-wrap: wrap;
        gap: 5px;
        margin-bottom: 12px;
    }
    
    .leaderboard-tab {
        font-size: 10px;
        padding: 8px 6px;
    }
    
    .leaderboard-list {
        gap: 6px;
        max-height: 400px;
    }
    
    .leaderboard-item {
        gap: 10px;
        padding: 8px;
    }
    
    .leaderboard-rank {
        font-size: 16px;
        min-width: 30px;
    }
    
    .leaderboard-name {
        font-size: 11px !important;
    }
    
    .leaderboard-score {
        font-size: 13px !important;
    }
    
    .leaderboard-loading,
    .leaderboard-error {
        font-size: 11px !important;
        padding: 30px;
    }
    
    .tutorial-content {
        padding: 25px 15px;
        max-width: 90%;
    }
    
    .tutorial-icon {
        font-size: 48px;
        margin-bottom: 15px;
    }
    
    .tutorial-title {
        font-size: 18px !important;
        margin-bottom: 10px;
    }
    
    .tutorial-text {
        font-size: 13px !important;
        margin-bottom: 18px;
    }
    
    .tutorial-btn {
        padding: 9px 18px;
        font-size: 12px !important;
    }
    
    .tutorial-progress {
        margin-top: 12px;
        font-size: 10px !important;
    }
} /* Конец @media (max-width: 768px) для Prestige/Leaderboard/Tutorial */

/* === HINTS SYSTEM === */
.hint-overlay {
    position: fixed;
    z-index: 5000;
    pointer-events: none;
}

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

.hint-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #ffd700;
    border-radius: 12px;
    padding: 20px;
    max-width: 300px;
    box-shadow: 0 10px 40px rgba(255, 215, 0, 0.4);
    animation: hintPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: all;
    position: relative;
    /* Адаптивное масштабирование (п. 1.10.1) - использует CSS переменную */
    transform: scale(var(--modal-scale, 1));
    transform-origin: center center;
    will-change: transform;
}

@keyframes hintPop {
    from {
        transform: scale(calc(var(--modal-scale, 1) * 0.8));
        opacity: 0;
    }
    to {
        transform: scale(var(--modal-scale, 1));
        opacity: 1;
    }
}

.hint-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
    pointer-events: none;
}

/* Arrow positions */
.hint-overlay.arrow-top .hint-arrow {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 10px 10px 10px;
    border-color: transparent transparent #ffd700 transparent;
}

.hint-overlay.arrow-bottom .hint-arrow {
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px 10px 0 10px;
    border-color: #ffd700 transparent transparent transparent;
}

.hint-overlay.arrow-left .hint-arrow {
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-width: 10px 10px 10px 0;
    border-color: transparent #ffd700 transparent transparent;
}

.hint-overlay.arrow-right .hint-arrow {
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-width: 10px 0 10px 10px;
    border-color: transparent transparent transparent #ffd700;
}

.hint-icon {
    font-size: 32px;
    text-align: center;
    margin-bottom: 10px;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.hint-title {
    font-size: 16px;
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 8px;
    text-align: center;
}

.hint-text {
    font-size: 13px;
    color: #ddd;
    line-height: 1.5;
    margin-bottom: 15px;
    text-align: center;
}

.hint-btn {
    width: 100%;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4a 100%);
    color: #000;
    border: none;
    padding: 10px;
    font-size: 13px;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.hint-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.4);
}

/* Highlight effect for target element */
.hint-highlight {
    position: relative;
    z-index: 4999;
    animation: highlightPulse 2s infinite;
}

@keyframes highlightPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(255, 215, 0, 0);
    }
}

/* === MOBILE RESPONSIVE FOR HINTS === */
@media (max-width: 768px) {
    .hint-content {
        max-width: 250px;
        padding: 15px;
    }
    
    .hint-icon {
        font-size: 24px;
    }
    
    .hint-title {
        font-size: 13px !important;
    }
    
    .hint-text {
        font-size: 11px !important;
    }
    
    .hint-btn {
        font-size: 11px !important;
        padding: 8px;
    }
} /* Конец @media (max-width: 768px) для Hints System */

/* === DESKTOP ENHANCEMENTS (Larger Central Elements) === */
@media (min-width: 601px) {
    /* Карточка для десктопа */
    .mystery-card {
        width: 280px !important;
        height: 420px !important;
    }
    
    /* Текст монет */
    .coins-display {
        font-size: 42px !important;
        margin-bottom: 8px !important;
    }
    
    /* Кнопки */
    .action-btn {
        width: 180px !important;
        height: 90px !important;
        font-size: 22px !important;
    }
    
    #rollBtn {
        width: 180px !important;
        height: 90px !important;
        font-size: 22px !important;
        box-shadow: 0 6px 0 #b29600, 0 0 20px rgba(255, 215, 0, 0.4) !important;
    }
    
    #rollBtn:active {
        box-shadow: 0 3px 0 #b29600 !important;
    }
    
    .roll-group {
        width: 180px !important;
    }
    
    .auto-btn {
        font-size: 12px !important;
        padding: 8px 0 !important;
    }
    
    /* Знак вопроса */
    #rollText {
        font-size: 90px !important;
    }
    
    /* Текст редкости */
    #rollRarity {
        font-size: 15px !important;
        padding: 8px 16px !important;
        margin-bottom: 28px !important;
        letter-spacing: 2px !important;
    }
    
    /* Gap между элементами */
    .game {
        gap: 28px !important;
    }
    
    .controls {
        gap: 24px !important;
    }
}
