/* ============================================
   SLOTS - Игра "Слоты"
   ============================================ */

/* ========== ПЛАТФОРМО-ЗАВИСИМЫЕ ПОЗИЦИИ ========== */

/* По умолчанию (Default) */
#game-screen {
    padding-top: calc(1rem + 25px) !important;
    min-height: 100vh;
    background: 
        url('../assets/bg-slots.svg') center top / cover no-repeat fixed,
        linear-gradient(180deg, #0a0a1a 0%, #1a1a2e 50%, #0f0f23 100%) !important;
}

#game-screen header {
    top: 25px !important;
    background: transparent !important;
}
#game-screen header::before { display: none !important; }

#slot-machine {
    margin-top: 0 !important;
}

/* iOS: настройка позиций для слотов */
html[data-platform="ios"] #game-screen {
    padding-top: calc(1rem + 35px) !important;
}

html[data-platform="ios"] #game-screen header {
    top: 90px !important;
    background: transparent !important;
}

html[data-platform="ios"] #slot-machine {
    margin-top: 80px !important;
}

/* Android: настройка позиций для слотов */
html[data-platform="android"] #game-screen {
    padding-top: calc(1rem + 35px) !important;
}

html[data-platform="android"] #game-screen header {
    top: 70px !important;
    background: transparent !important;
}

html[data-platform="android"] #slot-machine {
    margin-top: 65px !important;
}

/* ========== НИЖНИЙ КОНТЕНТ СЛОТОВ ========== */

/* По умолчанию */
#game-screen main {
    margin-bottom: 0 !important;
}

/* iOS: опускаем/поднимаем весь нижний контент слотов */
html[data-platform="ios"] #game-screen main {
    margin-bottom: -28px !important;
}

/* Android: опускаем/поднимаем весь нижний контент слотов */
html[data-platform="android"] #game-screen main {
    margin-bottom: -28px !important;
}

/* Отключаем верхнюю тёмную полосу у слотов */
#game-screen::before { display: none !important; }

/* ========== СТИЛИ СЛОТ-МАШИНЫ ========== */

#slot-machine {
    position: relative;
    width: 100%;
    max-width: 360px;
    transition: max-width 0.4s ease;
}

#slot-machine .slot-frame {
    width: 100%;
    height: auto;
    transition: transform 0.4s ease;
}

.reels-container {
    position: absolute;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    transition: all 0.4s ease;
}

.reel-column {
    height: 100%;
    overflow: hidden;
    background: #222222;
    border-radius: 10px;
    position: relative;
}

/* Фоновый слой для параллакса */
.reel-parallax-back {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    opacity: 0.18;
    filter: blur(0.5px);
}
.reel-parallax-back .reel {
    opacity: 1;
}

/* --- Стили для 1 линии (3 барабана, 1 ряд - как 3x3) --- */
#slot-machine.mode-1-line { max-width: 380px; }
#slot-machine.mode-1-line .slot-frame { transform: scaleY(1) translateY(0) !important; }
#slot-machine.mode-1-line .reels-container { 
    top: 54%; 
    width: 78%; 
    height: 80%;
    gap: 5%;
}
#slot-machine.mode-1-line .reel-column:not(.hidden) { 
    width: 30%;
}
#slot-machine.mode-1-line .reel-column {
    overflow: hidden;
    position: relative;
}

/* --- Стили для 3 линий (3 ряда x 3 барабана) --- */
#slot-machine.mode-3-lines { max-width: 380px; }
#slot-machine.mode-3-lines .slot-frame { transform: scaleY(1) translateY(0) !important; }
#slot-machine.mode-3-lines .reels-container { top: 54%; width: 78%; height: 80%; }
#slot-machine.mode-3-lines .reel-column:not(.hidden) { width: 30%; }

/* --- Стили для 5 линий (3 ряда x 5 барабанов) --- */
#slot-machine.mode-5-lines { max-width: 450px; }
#slot-machine.mode-5-lines .slot-frame { transform: scaleY(1) translateY(0) !important; }
#slot-machine.mode-5-lines .reels-container { top: 55%; width: 90%; height: 70%; }
#slot-machine.mode-5-lines .reel-column:not(.hidden) {
    width: 18.4%;
}

/* ========== КОНТЕЙНЕР СИМВОЛОВ ========== */

.reel-symbols-container {
    padding-top: 0px;
    background-color: #222222;
}

/* Компенсируем отступ для каждого режима отдельно */
#slot-machine.mode-1-line .reel-symbols-container {
    margin-top: 0;
}
#slot-machine.mode-3-lines .reel-symbols-container {
    margin-top: -30px; 
}
#slot-machine.mode-5-lines .reel-symbols-container {
    margin-top: 0px; 
}

/* ========== СИМВОЛЫ ========== */

.reel {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    border-radius: 0.5rem;
    color: #000;
    text-shadow: 1px 1px 2px #222222;
    box-shadow: inset 0 0 10px #222222;
    font-family: 'Bebas Neue', cursive;
    flex-shrink: 0;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.reel.ghost { 
    opacity: 0.5; 
    filter: saturate(0.7) brightness(0.9); 
}

/* Редкие символы: эффект вертикального заполнения */
.reel.rare { 
    position: relative; 
    overflow: hidden; 
}
.reel.rare::after {
    content: '';
    position: absolute; 
    left: 0; 
    right: 0; 
    bottom: 0; 
    height: 0%;
    background: linear-gradient(180deg, rgba(255,215,0,0.35) 0%, rgba(255,255,255,0.0) 100%);
    transition: height 600ms ease;
}
.reel.rare.is-final::after { 
    height: 100%; 
}

/* ========== ЛИНИИ ВЫИГРЫША ========== */

#win-lines-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#win-lines-svg line, 
#win-lines-svg polyline {
    stroke: #ffd700;
    stroke-width: 5px;
    stroke-linecap: round;
    opacity: 0.9;
    filter: drop-shadow(0 0 5px #fff) drop-shadow(0 0 10px #fff);
    transition: opacity 0.3s ease-out, stroke-dashoffset 0.6s ease-out;
}

/* ========== АНИМАЦИИ ВЫИГРЫША ========== */

/* Крупный выигрыш: лёгкая тряска */
@keyframes bigWinWiggle { 
    0% { transform: none; } 
    30% { transform: scale(1.03) rotate(0.5deg); } 
    100% { transform: none; } 
}
#game-screen.big-win-shake { 
    animation: bigWinWiggle 700ms ease; 
}

.reel.scatter-win {
    animation: scatter-glow 1.5s infinite alternate;
    transform: scale(1.05);
    z-index: 10;
}

@keyframes scatter-glow {
    from { box-shadow: inset 0 0 10px #222, 0 0 10px 2px #fff, 0 0 20px 5px #ffd700; }
    to   { box-shadow: inset 0 0 10px #222, 0 0 20px 5px #fff, 0 0 40px 10px #ffae00; }
}

/* ========== ДЖЕКПОТ ОВЕРЛЕЙ ========== */

#jackpot-overlay { display: none; }
#jackpot-overlay:not(.hidden) { display: flex; }

#jackpot-overlay .jackpot-backdrop {
    background: radial-gradient(60% 60% at 50% 40%, rgba(255, 215, 0, 0.15) 0%, rgba(255, 165, 0, 0.1) 40%, rgba(0,0,0,0.85) 100%);
    animation: jackpot-fade-in 250ms ease forwards;
}

.jackpot-content { 
    transform: scale(0.8); 
    animation: jackpot-pop 400ms cubic-bezier(0.2, 0.9, 0.2, 1.2) forwards; 
}

.jackpot-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 56px;
    letter-spacing: 2px;
    background: linear-gradient(180deg, #fff 0%, #ffe089 30%, #ffb100 60%, #cc8400 100%);
    -webkit-background-clip: text; 
    background-clip: text; 
    color: transparent;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.45), 0 0 60px rgba(255, 170, 0, 0.3);
    filter: drop-shadow(0 2px 0 #5b3b00);
    animation: jackpot-shine 1800ms ease-in-out infinite;
}

.jackpot-amount {
    margin-top: 8px;
    font-size: 28px;
    font-weight: 800;
    color: #ffe089;
    text-shadow: 0 0 16px rgba(255, 215, 0, 0.6);
}

/* Частицы монет для джекпота */
.jackpot-coin {
    position: absolute; 
    width: 14px; 
    height: 14px; 
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fff 0%, #ffe089 35%, #ffb100 65%, #b87400 100%);
    box-shadow: 0 0 10px rgba(255, 200, 0, 0.6);
    pointer-events: none;
    animation: coin-burst 900ms ease-out forwards;
}

@keyframes jackpot-fade-in { 
    from { opacity: 0; } 
    to { opacity: 1; } 
}

@keyframes jackpot-pop { 
    from { transform: scale(0.8); opacity: 0; } 
    to { transform: scale(1); opacity: 1; } 
}

@keyframes jackpot-shine {
    0%, 100% { filter: drop-shadow(0 2px 0 #5b3b00) drop-shadow(0 0 26px rgba(255, 215, 0, 0.35)); }
    50% { filter: drop-shadow(0 2px 0 #5b3b00) drop-shadow(0 0 42px rgba(255, 225, 120, 0.75)); }
}

@keyframes coin-burst {
    0% { transform: translate(0, 0) scale(0.6); opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translate(var(--tx, 0px), var(--ty, -120px)) scale(1); opacity: 0; }
}

/* ========== КНОПКИ СТАВОК И ЛИНИЙ ========== */

.quick-bet-btn, .line-btn {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid #ffd700;
    color: #ffd700;
    transition: all 0.3s ease;
}

.quick-bet-btn.active, .line-btn.active {
    background: #ffd700;
    color: #1a1a1a;
    font-weight: bold;
}

/* ========== АНИМАЦИЯ МОНЕТ ========== */

#coin-container { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    overflow: hidden; 
    pointer-events: none; 
    z-index: 999; 
}

.coin { 
    position: absolute; 
    width: 20px; 
    height: 20px; 
    background-color: gold; 
    border-radius: 50%; 
    animation: fall linear; 
    opacity: 0; 
}

@keyframes fall { 
    0% { transform: translateY(-100px) rotate(0deg); opacity: 1; } 
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; } 
}

/* Хинты для производительности эффектов */
.coin, .jackpot-content, .jackpot-title, .reel, .reels-container {
    will-change: transform, opacity;
    backface-visibility: hidden;
}
