* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #FFC0CB 0%, #E0FFFF 40%, #FFFACD 70%, #B0E0E6 100%);
    background-size: 200% 200%;
    animation: pearl-gradient 8s ease-in-out infinite;
    padding: 20px;
    overflow-x: hidden;
    transition: background 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pearl-gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.container {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    border-radius: 24px;
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    padding: 30px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.18), 0 2px 8px 0 rgba(0,0,0,0.10);
    width: 95%;
    max-width: 400px;
    position: relative;
}

h1 {
    text-align: center;
    font-size: 1.3em;
    font-family: 'Arial Black', Arial, sans-serif;
    color: #2196f3;
    margin-bottom: 30px;
    margin-top: -15px;
    letter-spacing: 2px;
    background: none;
    background-clip: unset;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    text-fill-color: unset;
    filter: none;
    text-shadow: none;
    animation: none;
}

.game-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    color: white;
    font-size: 1.2em;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    margin: 30px auto;
    aspect-ratio: 1;
    width: 100%;
    max-width: 350px;
    padding: 2px;
    background: linear-gradient(135deg, #00eaff 0%, #b3e5fc 100%);
    border-radius: 18px;
    box-shadow: 0 4px 32px 0 rgba(0, 128, 128, 0.13);
    border: 2.5px solid rgba(0, 191, 165, 0.22);
}

.tile {
    position: relative;
    background: transparent;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: white;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s;
    aspect-ratio: 1;
    border: none;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.tile.empty {
    animation: emptyGlow 2s ease-in-out infinite alternate !important;
    border: 3px solid #00eaff !important;
    box-shadow: 
        0 0 7px #00eaff,
        0 0 14px #00eaff,
        0 0 22px #00eaff,
        inset 0 0 11px rgba(0, 234, 255, 0.22) !important;
}

@keyframes emptyGlow {
    0% {
        box-shadow: 
            0 0 7px #00eaff,
            0 0 14px #00eaff,
            0 0 22px #00eaff,
            inset 0 0 11px rgba(0, 234, 255, 0.22);
        border-color: #00eaff;
    }
    100% {
        box-shadow: 
            0 0 11px #00eaff,
            0 0 18px #00eaff,
            0 0 25px #00eaff,
            inset 0 0 14px rgba(0, 234, 255, 0.36);
        border-color: #00eaff; /* Оставляем тот же ярко синий цвет */
    }
}

.tile:not(.empty):hover {
    transform: scale(1.08);
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
}

.heart {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.5);
    animation: pulse 2s infinite;
    transform-origin: center;
    left: 0;
    top: 0;
}

.svg-heart {
    position: absolute;
    width: 96%;
    height: 96%;
    left: 2%;
    top: 2%;
    z-index: 0;
    pointer-events: none;
    display: block;
    animation: pulse 1.6s infinite ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

.tile-number {
    font-size: 1.5em;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5),
        -1px -1px 0 rgba(0, 0, 0, 0.3),
        1px -1px 0 rgba(0, 0, 0, 0.3),
        -1px 1px 0 rgba(0, 0, 0, 0.3),
        1px 1px 0 rgba(0, 0, 0, 0.3);
    z-index: 1;
    font-weight: 900;
    font-family: Arial, sans-serif;
    pointer-events: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.glass-btn, .music-btn {
    color: #2196f3 !important;
}

.glass-btn {
    width: 100%;
    padding: 15px;
    border: none;
    background: linear-gradient(135deg, rgba(255,255,255,0.35) 0%, rgba(0,255,255,0.13) 100%);
    backdrop-filter: blur(5px);
    border-radius: 10px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(.4,1.02,.64,1);
    box-shadow: 0 2px 12px 0 rgba(33,150,243,0.10);
    border: 1.5px solid rgba(255,255,255,0.25);
    font-weight: bold;
}

.glass-btn:hover, .glass-btn:focus {
    background: linear-gradient(135deg, rgba(255,255,255,0.45) 0%, rgba(0,255,255,0.22) 100%);
    box-shadow: 0 6px 24px 0 rgba(33,150,243,0.18), 0 0 12px 2px #00eaff55;
    transform: scale(1.08);
    color: #1565c0;
}

.glass-btn:active {
    transform: scale(0.97);
}

/* Медиа-запросы для адаптивности */
@media (max-width: 768px) {
    .container {
        padding: 30px 25px;
        max-width: 420px;
        margin: 10px auto;
    }
    
    .game-board {
        max-width: 350px;
        margin: 35px auto;
    }
    
    h1 {
        margin-top: -10px;
        font-size: 1.3em;
        margin-bottom: 35px;
    }
    
    .game-stats {
        margin-bottom: 45px;
    }
    
    .tile-number {
        font-size: 3.5em;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 25px 20px;
        max-width: 380px;
        margin: 5px auto;
    }
    
    .game-board {
        max-width: 320px;
        margin: 30px auto;
        gap: 2px;
    }
    
    h1 {
        margin-top: -5px;
        font-size: 1.2em;
        margin-bottom: 30px;
    }
    
    .game-stats {
        margin-bottom: 40px;
    }
    
    .tile-number {
        font-size: 3em;
    }
}

@media (max-width: 350px) {
    .container {
        padding: 20px 15px;
        max-width: 340px;
        margin: 2px auto;
    }
    
    .game-board {
        max-width: 300px;
        margin: 25px auto;
    }
    
    h1 {
        margin-top: -2px;
        font-size: 1.1em;
        margin-bottom: 25px;
    }
    
    .game-stats {
        margin-bottom: 35px;
    }
    
    .tile-number {
        font-size: 2.5em;
    }
    
    #recordsBtn {
        max-width: 300px; /* Точная ширина игрового поля на малых экранах */
    }
}

/* Добавляем эффект свечения при нажатии */
.tile:not(.empty):active {
    transform: scale(0.95);
    background: linear-gradient(135deg, #66b5ff, #0073e6);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

@media (max-width: 600px) {
    .container {
        max-width: 98vw;
        padding: 8px;
    }
    .game-board {
        max-width: 98vw;
        gap: 1.5vw;
        padding: 1vw;
    }
    .tile-number {
        font-size: 0.9em;
    }
    .tile.empty {
        animation: none !important;
        border: 2px dashed rgba(255,255,255,0.3);
    }
}

@media (max-width: 400px) {
    .container {
        padding: 2vw;
        border-radius: 10px;
    }
    .game-board {
        gap: 1vw;
        padding: 0.5vw;
    }
    .tile-number {
        font-size: 0.7em;
    }
}

/* Увеличиваем кликабельность кнопок на мобильных */
.glass-btn, #newGameBtn {
    min-height: 44px;
    font-size: 1.1em;
}

/* Компактные кнопки управления игрой */
.container .glass-btn {
    margin: 8px auto;
    padding: 12px 20px;
    font-size: 1em;
    min-height: 40px;
    max-width: 200px;
    width: 100%;
}

/* Контейнер для кнопок в ряд */
.game-controls-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 8px auto;
    max-width: 400px;
    width: 100%;
}

/* Кнопки в ряду */
.game-controls-row .glass-btn {
    margin: 0;
    flex: 1;
    max-width: none;
    min-width: 0;
}

/* Кнопка "Новая игра" */
#newGameBtn {
    margin: 12px auto 8px auto;
    padding: 14px 24px;
    font-size: 1.1em;
    min-height: 44px;
    max-width: 220px;
    width: 100%;
}

/* Кнопка "Правила игры" */
#rulesBtn {
    margin: 6px auto;
    padding: 10px 18px;
    font-size: 0.95em;
    min-height: 38px;
    max-width: 180px;
    width: 100%;
}

/* Кнопка "Рекорды" - отдельно под ними */
#recordsBtn {
    margin: 8px auto;
    padding: 10px 18px;
    font-size: 0.95em;
    min-height: 38px;
    max-width: 350px; /* Точная ширина игрового поля */
    width: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.35) 0%, rgba(0,255,255,0.18) 100%); /* На 10% темнее */
    border: 2px solid rgba(33,150,243,0.25); /* На 10% темнее */
    box-shadow: 0 4px 16px 0 rgba(33,150,243,0.15); /* На 10% темнее */
}

#recordsBtn:hover, #recordsBtn:focus {
    background: linear-gradient(135deg, rgba(33,150,243,0.25) 0%, rgba(0,255,255,0.15) 100%); /* На 10% темнее */
    color: #0d47a1; /* На 10% темнее */
    box-shadow: 0 6px 24px 0 rgba(33,150,243,0.25), 0 0 12px 2px rgba(33,150,243,0.1); /* На 10% темнее */
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .game-controls-row {
        gap: 8px;
        margin: 6px auto;
    }
    
    .container .glass-btn {
        margin: 6px auto;
        padding: 10px 16px;
        font-size: 0.95em;
        min-height: 36px;
        max-width: 180px;
    }
    
    #newGameBtn {
        margin: 10px auto 6px auto;
        padding: 12px 20px;
        font-size: 1em;
        min-height: 40px;
        max-width: 200px;
    }
    
    #rulesBtn, #recordsBtn {
        margin: 4px auto;
        padding: 8px 14px;
        font-size: 0.9em;
        min-height: 34px;
        max-width: 160px;
    }
    
    #recordsBtn {
        max-width: 350px; /* Точная ширина игрового поля на планшетах */
    }
}

@media (max-width: 480px) {
    .game-controls-row {
        gap: 6px;
        margin: 4px auto; /* Вернули исходный отступ */
    }
    
    .game-controls-row .glass-btn {
        margin: 2px auto; /* Вернули исходный отступ */
    }
    
    .container .glass-btn {
        margin: 4px auto; /* Вернули исходный отступ */
        padding: 8px 14px;
        font-size: 0.9em;
        min-height: 32px;
        max-width: 160px;
    }
    
    #newGameBtn {
        margin: 8px auto 4px auto; /* Вернули исходные отступы */
        padding: 10px 18px;
        font-size: 0.95em;
        min-height: 36px;
        max-width: 180px;
    }
    
    #rulesBtn, #recordsBtn {
        margin: 3px auto; /* Вернули исходный отступ */
        padding: 6px 12px;
        font-size: 0.85em;
        min-height: 30px;
        max-width: 140px;
    }
    
    #recordsBtn {
        max-width: 320px; /* Точная ширина игрового поля на мобильных */
        margin: 3px auto; /* Вернули исходный отступ */
    }
}

.modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    overflow: auto;
    background: rgba(0, 0, 0, 0.35);
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.modal.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #fff;
    margin: 10vh auto;
    padding: 24px 18px 18px 18px;
    border-radius: 18px;
    max-width: 350px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.25);
    color: #2196f3;
    font-size: 1.05em;
    position: relative;
    animation: modal-fade-in 0.4s;
    max-height: 80vh;
    overflow-y: auto;
}

@keyframes modal-fade-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

#winModal {
    display: flex;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    overflow: auto;
    background: rgba(0, 0, 0, 0.25);
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(.4,1.02,.64,1);
}
#winModal.open {
    opacity: 1;
    pointer-events: auto;
}
#winModal .modal-content {
    background: rgba(255,255,255,0.28);
    backdrop-filter: blur(18px) saturate(1.3);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    border-radius: 28px;
    border: 2.5px solid rgba(255,255,255,0.35);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.22), 0 2px 8px 0 rgba(0,0,0,0.10);
    padding: 36px 24px 28px 24px;
    max-width: 370px;
    width: 92vw;
    color: #2196f3;
    font-size: 1.18em;
    position: relative;
    text-align: center;
    animation: modal-fade-in 0.5s cubic-bezier(.4,1.02,.64,1);
    background-image: linear-gradient(135deg, #e0f7fa 0%, #fffbe0 100%);
    overflow: hidden;
}
#winModal h2 {
    font-family: 'Pacifico', 'Arial Black', cursive, Arial, sans-serif;
    font-size: 2.5em;
    color: #ff8c00;
    letter-spacing: 2px;
    margin-bottom: 16px;
    text-shadow: 0 2px 12px #ffa726, 0 1px 0 #ff9800, 0 0 8px #fffbe0;
    background: linear-gradient(90deg, #ff9800 0%, #ffa726 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
    filter: drop-shadow(0 2px 8px #ff980088);
    animation: winTitleGlow 2s ease-in-out infinite alternate;
}
#winModal #winText {
    color: #2196f3;
    font-size: 1.18em;
    margin-bottom: 18px;
    font-family: 'Segoe UI', 'Arial', sans-serif;
    text-shadow: 0 1px 6px #fffbe0, 0 0 2px #fff;
    font-weight: 500;
    line-height: 1.5;
}
#winModal .glass-btn {
    background: linear-gradient(135deg, rgba(255,255,255,0.45) 0%, rgba(255,255,224,0.22) 100%);
    color: #2196f3;
    border: 2px solid #ffe066;
    box-shadow: 0 2px 12px 0 #ffe06655;
    font-size: 1.15em;
    font-family: 'Segoe UI', 'Arial', sans-serif;
    border-radius: 12px;
    margin-top: 10px;
    transition: all 0.22s cubic-bezier(.4,1.02,.64,1);
}
#winModal .glass-btn:hover, #winModal .glass-btn:focus {
    background: linear-gradient(135deg, #fffbe0 0%, #ffe066 100%);
    color: #1565c0;
    box-shadow: 0 6px 24px 0 #ffe06699, 0 0 12px 2px #fffbe0;
    transform: scale(1.08);
}

.close {
    color: #2196f3;
    position: absolute;
    top: 10px;
    right: 18px;
    font-size: 2em;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}
.close:hover {
    color: #a259e6;
}

.music-btn {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 10;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(255,255,255,0.35);
    box-shadow: 0 4px 16px 0 rgba(33,150,243,0.12);
    border: 2px solid rgba(33,150,243,0.18);
    font-size: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.15s;
    outline: none;
    backdrop-filter: blur(4px);
}
.music-btn:hover, .music-btn:focus {
    background: rgba(33,150,243,0.18);
    color: #1565c0;
    box-shadow: 0 6px 24px 0 rgba(33,150,243,0.18);
    transform: scale(1.08);
}
@media (max-width: 600px) {
    .music-btn {
        top: 8px;
        right: 8px;
        width: 42px;
        height: 42px;
        font-size: 1.4em;
    }
}

@media (max-width: 600px) {
  .modal-content {
    max-width: 95vw !important;
    font-size: 1em !important;
    padding: 12vw 3vw 6vw 3vw !important;
    border-radius: 12px !important;
    margin: 10vw auto !important;
    box-sizing: border-box;
    max-height: 80vh;
    overflow-y: auto;
  }
  #winModal .modal-content {
    max-width: 95vw !important;
    font-size: 1em !important;
    padding: 12vw 3vw 6vw 3vw !important;
    border-radius: 12px !important;
    margin: 10vw auto !important;
    box-sizing: border-box;
    max-height: 80vh;
    overflow-y: auto;
  }
}

#confetti-container {
    position: fixed;
    pointer-events: none;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2000;
    overflow: hidden;
}

.pause-btn {
    position: absolute;
    top: 18px;
    left: 18px;
    z-index: 10;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(255,255,255,0.35);
    box-shadow: 0 4px 16px 0 rgba(33,150,243,0.12);
    border: 2px solid rgba(33,150,243,0.18);
    font-size: 2em;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.15s;
    outline: none;
    backdrop-filter: blur(4px);
    color: #2196f3;
}
.pause-btn:hover, .pause-btn:focus {
    background: rgba(33,150,243,0.18);
    color: #1565c0;
    box-shadow: 0 6px 24px 0 rgba(33,150,243,0.18);
    transform: scale(1.08);
}
@media (max-width: 600px) {
    .pause-btn {
        top: 8px;
        left: 8px;
        width: 42px;
        height: 42px;
        font-size: 1.4em;
    }
}

.moves, .timer {
    color: #7B3F00 !important;
    font-weight: bold;
    text-shadow: 1px 1px 2px #e0c9a6, 0 0 2px #fff2e0;
    letter-spacing: 1px;
}

.tile.clicked {
    animation: bounce-tile 0.18s cubic-bezier(.4,1.02,.64,1);
}
@keyframes bounce-tile {
    0% { transform: scale(1); }
    30% { transform: scale(1.08) translateY(-4px); }
    60% { transform: scale(0.97) translateY(1px); }
    100% { transform: scale(1); }
}

.tile.shake {
    animation: shake-tile 0.18s cubic-bezier(.36,.07,.19,.97);
}
@keyframes shake-tile {
    0% { transform: translateX(0); }
    20% { transform: translateX(-3px); }
    40% { transform: translateX(2px); }
    60% { transform: translateX(-2px); }
    80% { transform: translateX(1px); }
    100% { transform: translateX(0); }
}

/* Конфетти */
.confetti {
  position: fixed;
  left: 0; top: 0; width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 1000;
  filter: brightness(1.2) saturate(1.3);
  opacity: 0.95;
  will-change: transform, top, opacity;
}

/* Вспышка при победе */
.flash-win {
    position: fixed;
    left: 0; top: 0; width: 100vw; height: 100vh;
    background: radial-gradient(circle, #fff 0%, #fff0 80%);
    opacity: 0.7;
    z-index: 3000;
    pointer-events: none;
    animation: flashWin 0.8s cubic-bezier(.4,1.02,.64,1);
}
@keyframes flashWin {
    0% { 
        opacity: 0; 
        transform: scale(0.5);
    }
    50% { 
        opacity: 0.7; 
        transform: scale(1.2);
    }
    100% { 
        opacity: 0; 
        transform: scale(1.5);
    }
}

#helpBtn {
    margin-bottom: 8px;
}

/* Анимация пульсации поля при победе */
#gameBoard.win-pulse {
  animation: winPulse 1.2s cubic-bezier(.4,2,.6,1) 1;
}
@keyframes winPulse {
  0% { 
    box-shadow: 0 0 0 0 #2196f3cc; 
    transform: scale(1);
  }
  50% { 
    box-shadow: 0 0 40px 20px #2196f3cc; 
    transform: scale(1.05);
  }
  100% { 
    box-shadow: 0 0 0 0 #2196f3cc; 
    transform: scale(1);
  }
}

/* Подпрыгивание плиток при победе */
.tile.clicked {
  animation: tileJump 0.9s cubic-bezier(.4,2,.6,1);
}
@keyframes tileJump {
  0% { 
    transform: scale(1) translateY(0) rotate(0deg); 
  }
  20% { 
    transform: scale(1.1) translateY(-18px) rotate(5deg); 
  }
  40% { 
    transform: scale(0.98) translateY(2px) rotate(-3deg); 
  }
  60% { 
    transform: scale(1.04) translateY(-8px) rotate(2deg); 
  }
  80% { 
    transform: scale(1) translateY(0) rotate(-1deg); 
  }
  100% { 
    transform: scale(1) translateY(0) rotate(0deg); 
  }
}

/* Дополнительная анимация для плиток при победе */
.tile.win-celebrate {
  animation: winCelebrate 1.5s ease-in-out infinite;
}
@keyframes winCelebrate {
  0%, 100% { 
    transform: scale(1) rotate(0deg); 
    filter: brightness(1);
  }
  25% { 
    transform: scale(1.1) rotate(5deg); 
    filter: brightness(1.2) hue-rotate(10deg);
  }
  50% { 
    transform: scale(1.05) rotate(-3deg); 
    filter: brightness(1.1) hue-rotate(-5deg);
  }
  75% { 
    transform: scale(1.08) rotate(2deg); 
    filter: brightness(1.15) hue-rotate(8deg);
  }
}

/* Жёлтая подсветка для пустого поля */
.tile.empty.highlight {
  background: transparent !important;
  border: 2px solid #ffe066;
  box-shadow: 0 0 0 2px #ffe06688, 0 0 12px 3px #fffbe088, 0 0 18px 6px #ffe06644;
  animation: emptyHighlight 1.2s cubic-bezier(.4,1.02,.64,1) infinite alternate;
}
@keyframes emptyHighlight {
  0% { box-shadow: 0 0 0 2px #ffe06688, 0 0 12px 3px #fffbe088, 0 0 18px 6px #ffe06644; }
  100% { box-shadow: 0 0 0 4px #ffe06655, 0 0 18px 7px #fffbe044, 0 0 28px 12px #ffe06622; }
}

/* Убрать пульсацию у пустого поля */
.tile.empty {
  animation: none !important;
  /* остальной стиль оставить */
}

.glass-win-modal {
  display: none;
  position: fixed;
  z-index: 3000;
  left: 0; top: 0; width: 100vw; height: 100vh;
  background: rgba(0, 191, 165, 0.18);
  justify-content: center;
  align-items: center;
  transition: opacity 0.4s cubic-bezier(.4,1.02,.64,1);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(8px);
}
.glass-win-modal.open {
  display: flex;
  opacity: 1;
  pointer-events: auto;
  animation: winModalFadeIn 0.6s cubic-bezier(.4,1.02,.64,1);
}
.win-modal-content {
  background: linear-gradient(135deg, #00eaffcc 0%, #b3e5fcbb 100%);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-radius: 28px;
  border: 2.5px solid rgba(255,255,255,0.35);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.22), 0 2px 8px 0 rgba(0,0,0,0.10);
  padding: 38px 28px 28px 28px;
  max-width: 370px;
  width: 92vw;
  color: #2196f3;
  font-size: 1.18em;
  position: relative;
  text-align: center;
  animation: winModalContentIn 0.8s cubic-bezier(.4,1.02,.64,1);
  overflow: hidden;
  transform: scale(0.8);
  opacity: 0;
}
.glass-win-modal.open .win-modal-content {
  transform: scale(1);
  opacity: 1;
}
.win-modal-content h2 {
  font-family: 'Pacifico', 'Arial Black', cursive, Arial, sans-serif;
  font-size: 2.5em;
  color: #ff8c00;
  letter-spacing: 2px;
  margin-bottom: 16px;
  text-shadow: 0 2px 12px #ffa726, 0 1px 0 #ff9800, 0 0 8px #fffbe0;
  background: linear-gradient(90deg, #ff9800 0%, #ffa726 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px #ff980088);
  animation: winTitleGlow 2s ease-in-out infinite alternate;
}
.win-modal-content .win-stats {
  color: #1565c0;
  font-size: 1.15em;
  font-family: 'Segoe UI', 'Arial', sans-serif;
  text-shadow: 0 1px 6px #fffbe0, 0 0 2px #fff;
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 12px;
  animation: winStatsSlideIn 0.6s ease-out 0.3s both;
}
.win-modal-content .win-code {
  color: #00bfae;
  font-size: 1.25em;
  font-family: 'Arial Black', 'Arial', sans-serif;
  letter-spacing: 1px;
  margin-bottom: 18px;
  text-shadow: 0 2px 8px #b3e5fc, 0 0 2px #fffbe0;
  animation: winCodeBounce 0.8s ease-out 0.5s both;
}
.win-modal-content .glass-btn {
  background: linear-gradient(135deg, rgba(255,255,255,0.45) 0%, rgba(0,255,255,0.22) 100%);
  color: #2196f3;
  border: 2px solid #00eaff;
  box-shadow: 0 2px 12px 0 #00eaff55;
  font-size: 1.15em;
  font-family: 'Segoe UI', 'Arial', sans-serif;
  border-radius: 12px;
  margin-top: 10px;
  transition: all 0.22s cubic-bezier(.4,1.02,.64,1);
  animation: winButtonSlideIn 0.6s ease-out 0.7s both;
  transform: translateY(20px);
  opacity: 0;
}
.glass-win-modal.open .win-modal-content .glass-btn {
  transform: translateY(0);
  opacity: 1;
}
.win-modal-content .glass-btn:hover, .win-modal-content .glass-btn:focus {
  background: linear-gradient(135deg, #b3e5fc 0%, #00eaff 100%);
  color: #1565c0;
  box-shadow: 0 6px 24px 0 #00eaff99, 0 0 12px 2px #b3e5fc;
  transform: scale(1.08);
}

/* Анимации для окна победы */
@keyframes winModalFadeIn {
  0% { 
    opacity: 0; 
    backdrop-filter: blur(0px);
  }
  100% { 
    opacity: 1; 
    backdrop-filter: blur(8px);
  }
}

@keyframes winModalContentIn {
  0% { 
    transform: scale(0.8) rotate(-5deg); 
    opacity: 0; 
  }
  50% { 
    transform: scale(1.05) rotate(2deg); 
    opacity: 0.8; 
  }
  100% { 
    transform: scale(1) rotate(0deg); 
    opacity: 1; 
  }
}

@keyframes winTitleGlow {
  0% { 
    filter: drop-shadow(0 2px 8px #ff980088);
    transform: scale(1);
  }
  100% { 
    filter: drop-shadow(0 4px 16px #ff9800cc);
    transform: scale(1.02);
  }
}

@keyframes winStatsSlideIn {
  0% { 
    transform: translateX(-30px); 
    opacity: 0; 
  }
  100% { 
    transform: translateX(0); 
    opacity: 1; 
  }
}

@keyframes winCodeBounce {
  0% { 
    transform: scale(0.5); 
    opacity: 0; 
  }
  50% { 
    transform: scale(1.1); 
    opacity: 0.8; 
  }
  100% { 
    transform: scale(1); 
    opacity: 1; 
  }
}

@keyframes winButtonSlideIn {
  0% { 
    transform: translateY(20px); 
    opacity: 0; 
  }
  100% { 
    transform: translateY(0); 
    opacity: 1; 
  }
}

/* Стили для рекордов */
.record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.record-label {
    color: #1565c0;
    font-weight: 500;
    font-size: 0.95em;
}

.record-value {
    color: #00bfae;
    font-weight: bold;
    font-size: 1.1em;
    text-shadow: 0 1px 3px rgba(0, 191, 165, 0.3);
}

.new-record {
    color: #ffd600;
    font-weight: bold;
    font-size: 1.1em;
    text-shadow: 0 2px 4px rgba(255, 214, 0, 0.5);
    animation: newRecordGlow 2s ease-in-out infinite alternate;
}

@keyframes newRecordGlow {
    0% { 
        text-shadow: 0 2px 4px rgba(255, 214, 0, 0.5);
        transform: scale(1);
    }
    100% { 
        text-shadow: 0 4px 8px rgba(255, 214, 0, 0.8);
        transform: scale(1.05);
    }
}

/* Эффекты параллакса */
.parallax-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.parallax-element {
    position: absolute;
    opacity: 0.1;
    animation: float 20s ease-in-out infinite;
}

.parallax-element:nth-child(1) {
    top: 10%;
    left: 10%;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, #4fc3f7 0%, transparent 70%);
    animation-delay: 0s;
}

.parallax-element:nth-child(2) {
    top: 60%;
    right: 15%;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, #81d4fa 0%, transparent 70%);
    animation-delay: -5s;
}

.parallax-element:nth-child(3) {
    top: 30%;
    left: 70%;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, #00bfae 0%, transparent 70%);
    animation-delay: -10s;
}

.parallax-element:nth-child(4) {
    top: 80%;
    left: 20%;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, #b3e5fc 0%, transparent 70%);
    animation-delay: -15s;
}

@keyframes float {
    0%, 100% { 
        transform: translateY(0px) rotate(0deg); 
    }
    25% { 
        transform: translateY(-20px) rotate(90deg); 
    }
    50% { 
        transform: translateY(-10px) rotate(180deg); 
    }
    75% { 
        transform: translateY(-30px) rotate(270deg); 
    }
}

/* Стили для глобальных рекордов */
.global-records-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid rgba(255, 255, 255, 0.2);
}

.global-records-section h3 {
    color: #00bfae;
    font-size: 1.3em;
    margin-bottom: 15px;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 191, 165, 0.3);
}

.global-stats {
    margin-bottom: 20px;
}

.global-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 8px;
    background: rgba(0, 191, 165, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(0, 191, 165, 0.2);
}

.global-stat span:first-child {
    color: #1565c0;
    font-size: 0.9em;
}

.global-value {
    color: #00bfae;
    font-weight: bold;
    font-size: 1em;
}

.leaderboards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.leaderboard h4 {
    color: #ffd600;
    font-size: 1.1em;
    margin-bottom: 10px;
    text-align: center;
    text-shadow: 0 1px 3px rgba(255, 214, 0, 0.3);
}

.leaderboard-list {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 8px;
    margin-bottom: 5px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    font-size: 0.85em;
}

.leaderboard-item:last-child {
    margin-bottom: 0;
}

.rank {
    color: #ffd600;
    font-weight: bold;
    min-width: 20px;
}

.player {
    color: #1565c0;
    flex: 1;
    margin: 0 8px;
    text-align: center;
}

.score {
    color: #00bfae;
    font-weight: bold;
    min-width: 60px;
    text-align: right;
}

/* Адаптивность для мобильных */
@media (max-width: 480px) {
    .leaderboards {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .leaderboard-item {
        font-size: 0.8em;
        padding: 4px 6px;
    }
    
    .global-stat {
        font-size: 0.85em;
        padding: 6px;
    }
} 