* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Запрет выделения текста */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Запрет перетаскивания элементов */
    -webkit-user-drag: none;
    user-drag: none;
}

button {
    touch-action: manipulation;
    overscroll-behavior: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
    overscroll-behavior: none;
}

body {
    background: #1a2149;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overscroll-behavior: none;
    overscroll-behavior-x: none;
    overscroll-behavior-y: none;
    -webkit-overflow-scrolling: touch;
}

/* Letterbox контейнер - фиксированный размер 1080x1920 */
.game-wrapper {
    width: 1080px;
    height: 1920px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    transform-origin: center center;
    background: #151b41;
    overflow: hidden;
    overscroll-behavior: none;
}

.game-header {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 2;
    padding: 0 30px;
}

.score-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    width: 100%;
}

.score-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 30px;
    border-radius: 15px;
    border: 2px solid rgba(150, 220, 240, 0.3);
    text-align: center;
}

.score-item.score-current {
    min-width: 200px;
}

.score-item.score-record {
    min-width: 200px;
}

.score-value {
    font-size: 3rem;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    letter-spacing: 4px;
    color: #fff;
    text-shadow: 0 0 10px rgba(100, 200, 255, 0.5);
    transition: all 0.3s ease;
}

.score-item.pulse .score-value {
    animation: scorePulse 0.6s ease-out;
}

@keyframes scorePulse {
    0% {
        transform: scale(1);
        color: #fff;
        text-shadow: 0 0 10px rgba(100, 200, 255, 0.5);
    }
    50% {
        transform: scale(1.15);
        color: #ffff00;
        text-shadow: 0 0 20px rgba(255, 255, 0, 0.8), 0 0 40px rgba(100, 200, 255, 0.6);
    }
    100% {
        transform: scale(1);
        color: #fff;
        text-shadow: 0 0 10px rgba(100, 200, 255, 0.5);
    }
}

.btn-refresh {
    width: 70px;
    height: 70px;
    background: linear-gradient(145deg, #2a6a7b, #1a5a6b);
    border: 2px solid #4a9aab;
    border-radius: 8px;
    color: #fff;
    font-size: 2.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-refresh:hover {
    background: linear-gradient(145deg, #3a7a8b, #2a6a7b);
    transform: scale(1.1);
}

.btn-refresh:active {
    transform: scale(0.95);
    background: linear-gradient(145deg, #1a5a6b, #0a4a5b);
}

.controls-group {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-shrink: 0;
}

.btn-home {
    width: 90px;
    height: 90px;
    background: linear-gradient(145deg, #6a5a2a, #5a4a1a);
    border: 2px solid #aa8a4a;
    border-radius: 8px;
    color: #fff;
    font-size: 3.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    line-height: 1;
}

.btn-home:hover {
    background: linear-gradient(145deg, #7a6a3a, #6a5a2a);
    transform: scale(1.1);
}

.btn-home:active {
    transform: scale(0.95);
    background: linear-gradient(145deg, #5a4a1a, #4a3a0a);
}

.btn-mute {
    width: 70px;
    height: 70px;
    background: linear-gradient(145deg, #7a3a2a, #6a2a1a);
    border: 2px solid #ba5a4a;
    border-radius: 8px;
    color: #fff;
    font-size: 2.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-mute:hover {
    background: linear-gradient(145deg, #8a4a3a, #7a3a2a);
    transform: scale(1.1);
}

.btn-mute:active {
    transform: scale(0.95);
    background: linear-gradient(145deg, #6a2a1a, #5a1a0a);
}

.btn-mute.muted {
    background: linear-gradient(145deg, #3a4a5a, #2a3a4a);
    border-color: #6a8aaa;
}

.btn-mute.muted:hover {
    background: linear-gradient(145deg, #4a5a6a, #3a4a5a);
    transform: scale(1.1);
}

.info-box {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px 30px;
    border-radius: 15px;
    border: 2px solid rgba(150, 220, 240, 0.3);
    margin-top: 20px;
    width: 940px;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    margin-left: auto;
    margin-right: auto;
}

.info-label {
    color: #fff;
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(100, 200, 255, 0.5);
    margin-bottom: 15px;
}

.info-content {
    color: #fff;
    font-size: 1.1rem;
    text-shadow: 0 0 10px rgba(100, 200, 255, 0.5);
}

.info-content p {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.5;
}

.level-progress {
    margin-top: 20px;
    display: flex;
    gap: 20px;
    align-items: center;
}

.progress-items-container {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.progress-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(100, 200, 255, 0.1);
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid rgba(100, 200, 255, 0.3);
}

.cube-indicator {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    border: 2px solid rgba(100, 200, 255, 0.5);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
}

.progress-text {
    color: #fff;
    font-size: 1.3rem;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(100, 200, 255, 0.5);
}

#level-progress-text {
    color: #fff;
    font-size: 1.3rem;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(100, 200, 255, 0.5);
}

.scene-container {
    perspective: 1200px;
    perspective-origin: 50% 35%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    overscroll-behavior: none;
}

.scene {
    transform-style: preserve-3d;
    transform: rotateX(50deg) rotateZ(45deg);
    position: relative;
}

.platform {
    position: absolute;
    left: 0;
    top: 0;
    transform-style: preserve-3d;
    transition: transform 0.8s ease-in-out;
    width: 510px;
    height: 510px;
}

.platform.completed-floor {
    pointer-events: none;
}

.start-platform {
    position: absolute;
    transform-style: preserve-3d;
}

.start-platform .tile {
    position: relative;
    left: 0;
    top: 0;
}

.start-platform .tile-top {
    background: linear-gradient(135deg,
        #5a6b7a 0%,
        #4a5a6a 50%,
        #5a6b7a 100%);
    border-color: rgba(100, 110, 120, 0.8);
    box-shadow:
        inset 0 0 20px rgba(0, 0, 0, 0.4),
        inset 2px 2px 5px rgba(255, 255, 255, 0.1),
        0 0 10px rgba(0, 0, 0, 0.3);
}

.start-platform .tile-front {
    background: linear-gradient(to bottom, #3a4a5a 0%, #1a2a3a 100%);
    border-color: rgba(70, 80, 90, 0.9);
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
}

.start-platform .tile-right {
    background: linear-gradient(to right, #3a4a5a 0%, #1a2a3a 100%);
    border-color: rgba(70, 80, 90, 0.9);
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
}

.tile {
    position: absolute;
    width: 85px;
    height: 85px;
    transform-style: preserve-3d;
    cursor: pointer;
    transition: transform 0.4s ease-out;
}

/* Поднятие плитки с кубиком вверх */
@keyframes tile-rise {
    0% {
        transform: translateZ(0px);
    }
    100% {
        transform: translateZ(120px);
    }
}

.tile.tile-rise-up {
    animation: tile-rise 0.4s ease-out forwards;
}

.tile:hover .tile-top {
    box-shadow: inset 0 0 15px rgba(255,255,255,0.2), 0 0 10px rgba(255, 255, 255, 0.3);
}

.tile-top {
    position: absolute;
    width: 85px;
    height: 85px;
    background:
        /* Основной цвет */
        linear-gradient(135deg,
            rgba(80, 160, 180, 0.8) 0%,
            rgba(60, 140, 160, 0.7) 50%,
            rgba(80, 160, 180, 0.8) 100%),
        /* Трещины 1 - диагональная слева-сверху вправо-вниз */
        linear-gradient(45deg,
            transparent 0%,
            transparent 35%,
            rgba(30, 80, 100, 0.4) 38%,
            rgba(20, 60, 80, 0.55) 40%,
            rgba(30, 80, 100, 0.4) 42%,
            transparent 45%,
            transparent 100%),
        /* Трещины 2 - диагональная справа-сверху влево-вниз */
        linear-gradient(135deg,
            transparent 0%,
            transparent 48%,
            rgba(20, 70, 90, 0.45) 50%,
            rgba(10, 50, 70, 0.6) 52%,
            rgba(20, 70, 90, 0.45) 54%,
            transparent 56%,
            transparent 100%),
        /* Трещины 3 - вертикальная слева */
        linear-gradient(90deg,
            transparent 0%,
            transparent 18%,
            rgba(25, 75, 95, 0.42) 19%,
            rgba(15, 55, 75, 0.58) 21%,
            rgba(25, 75, 95, 0.42) 23%,
            transparent 25%,
            transparent 100%),
        /* Трещины 4 - вертикальная справа */
        linear-gradient(90deg,
            transparent 0%,
            transparent 70%,
            rgba(22, 72, 92, 0.43) 71%,
            rgba(12, 52, 72, 0.59) 73%,
            rgba(22, 72, 92, 0.43) 75%,
            transparent 77%,
            transparent 100%),
        /* Трещины 5 - горизонтальная */
        linear-gradient(0deg,
            transparent 0%,
            transparent 42%,
            rgba(28, 78, 98, 0.41) 44%,
            rgba(18, 58, 78, 0.56) 46%,
            rgba(28, 78, 98, 0.41) 48%,
            transparent 50%,
            transparent 100%);
    background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
    background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0;
    background-repeat: no-repeat;
    border: 2px solid rgba(150, 220, 240, 0.9);
    transform: translateZ(84px);
    box-shadow:
        inset 0 0 20px rgba(255, 255, 255, 0.15),
        inset 2px 2px 4px rgba(255, 255, 255, 0.2),
        0 0 10px rgba(100, 180, 200, 0.2);
}

/* Вариант трещин 2 */
.tile:nth-child(2n) .tile-top:not(.frozen-tile) {
    background:
        /* Основной цвет */
        linear-gradient(135deg,
            rgba(80, 160, 180, 0.8) 0%,
            rgba(60, 140, 160, 0.7) 50%,
            rgba(80, 160, 180, 0.8) 100%),
        /* Одна диагональ и несколько горизонтальных */
        linear-gradient(25deg,
            transparent 0%,
            transparent 40%,
            rgba(25, 75, 95, 0.45) 43%,
            rgba(15, 55, 75, 0.57) 45%,
            rgba(25, 75, 95, 0.45) 47%,
            transparent 50%,
            transparent 100%),
        /* Три горизонтальные трещины */
        linear-gradient(0deg,
            transparent 0%,
            transparent 25%,
            rgba(20, 70, 90, 0.38) 26%,
            rgba(10, 50, 70, 0.52) 27%,
            rgba(20, 70, 90, 0.38) 28%,
            transparent 29%,
            transparent 55%,
            rgba(18, 68, 88, 0.39) 56%,
            rgba(8, 48, 68, 0.53) 57%,
            rgba(18, 68, 88, 0.39) 58%,
            transparent 59%,
            transparent 75%,
            rgba(22, 72, 92, 0.4) 76%,
            rgba(12, 52, 72, 0.54) 77%,
            rgba(22, 72, 92, 0.4) 78%,
            transparent 79%,
            transparent 100%),
        /* Две вертикальные */
        linear-gradient(90deg,
            transparent 0%,
            transparent 15%,
            rgba(28, 78, 98, 0.36) 16%,
            rgba(18, 58, 78, 0.5) 17%,
            rgba(28, 78, 98, 0.36) 18%,
            transparent 19%,
            transparent 75%,
            rgba(25, 75, 95, 0.37) 76%,
            rgba(15, 55, 75, 0.51) 77%,
            rgba(25, 75, 95, 0.37) 78%,
            transparent 79%,
            transparent 100%);
    background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%;
    background-position: 0 0, 0 0, 0 0, 0 0;
    background-repeat: no-repeat;
}

/* Вариант трещин 3 */
.tile:nth-child(3n) .tile-top:not(.frozen-tile) {
    background:
        /* Основной цвет */
        linear-gradient(135deg,
            rgba(80, 160, 180, 0.8) 0%,
            rgba(60, 140, 160, 0.7) 50%,
            rgba(80, 160, 180, 0.8) 100%),
        /* Две диагонали с разными углами */
        linear-gradient(60deg,
            transparent 0%,
            transparent 38%,
            rgba(24, 74, 94, 0.42) 40%,
            rgba(14, 54, 74, 0.56) 42%,
            rgba(24, 74, 94, 0.42) 44%,
            transparent 46%,
            transparent 100%),
        linear-gradient(120deg,
            transparent 0%,
            transparent 40%,
            rgba(20, 70, 90, 0.44) 42%,
            rgba(10, 50, 70, 0.58) 44%,
            rgba(20, 70, 90, 0.44) 46%,
            transparent 48%,
            transparent 100%),
        /* Одна центральная вертикальная */
        linear-gradient(90deg,
            transparent 0%,
            transparent 45%,
            rgba(26, 76, 96, 0.4) 48%,
            rgba(16, 56, 76, 0.55) 50%,
            rgba(26, 76, 96, 0.4) 52%,
            transparent 55%,
            transparent 100%);
    background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%;
    background-position: 0 0, 0 0, 0 0, 0 0;
    background-repeat: no-repeat;
}

/* Вариант трещин 4 */
.tile:nth-child(4n) .tile-top:not(.frozen-tile) {
    background:
        /* Основной цвет */
        linear-gradient(135deg,
            rgba(80, 160, 180, 0.8) 0%,
            rgba(60, 140, 160, 0.7) 50%,
            rgba(80, 160, 180, 0.8) 100%),
        /* Множество небольших трещин */
        linear-gradient(30deg,
            transparent 0%,
            transparent 32%,
            rgba(22, 72, 92, 0.38) 33%,
            rgba(12, 52, 72, 0.51) 34%,
            rgba(22, 72, 92, 0.38) 35%,
            transparent 36%,
            transparent 100%),
        linear-gradient(150deg,
            transparent 0%,
            transparent 55%,
            rgba(20, 70, 90, 0.39) 57%,
            rgba(10, 50, 70, 0.52) 58%,
            rgba(20, 70, 90, 0.39) 59%,
            transparent 61%,
            transparent 100%),
        /* Три горизонтальные */
        linear-gradient(0deg,
            transparent 0%,
            transparent 20%,
            rgba(24, 74, 94, 0.37) 21%,
            rgba(14, 54, 74, 0.5) 22%,
            rgba(24, 74, 94, 0.37) 23%,
            transparent 24%,
            transparent 50%,
            rgba(26, 76, 96, 0.38) 51%,
            rgba(16, 56, 76, 0.51) 52%,
            rgba(26, 76, 96, 0.38) 53%,
            transparent 54%,
            transparent 80%,
            rgba(23, 73, 93, 0.36) 81%,
            rgba(13, 53, 73, 0.49) 82%,
            rgba(23, 73, 93, 0.36) 83%,
            transparent 84%,
            transparent 100%);
    background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%;
    background-position: 0 0, 0 0, 0 0, 0 0;
    background-repeat: no-repeat;
}

/* Замороженная ячейка - плотный кубик льда/снега с голубым оттенком */
.tile-top.frozen-tile {
    background:
        /* Основной цвет - плотный лёд с голубым оттенком */
        linear-gradient(135deg,
            rgba(180, 210, 240, 1) 0%,
            rgba(150, 190, 230, 1) 50%,
            rgba(180, 210, 240, 1) 100%),
        /* Текстура шероховатости льда */
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.35) 1px, transparent 1px),
        radial-gradient(circle at 60% 70%, rgba(120, 180, 220, 0.25) 2px, transparent 2px),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.25) 1.5px, transparent 1.5px),
        /* Глубокие тени для эффекта глубины */
        linear-gradient(45deg, transparent 40%, rgba(100, 140, 180, 0.2) 50%, transparent 60%);
    background-size: 100% 100%, 500px 500px, 400px 400px, 600px 600px, 100% 100%;
    background-position: 0 0, 0 0, 20px 20px, 40px 10px, 0 0;
    background-repeat: no-repeat;
    border: 2px solid rgba(120, 160, 200, 0.95);
    box-shadow:
        inset 0 0 25px rgba(200, 230, 255, 0.6),
        inset 2px 2px 10px rgba(255, 255, 255, 0.4),
        inset -3px -3px 12px rgba(80, 140, 190, 0.3),
        0 0 15px rgba(150, 190, 230, 0.4),
        0 0 30px rgba(100, 160, 210, 0.2);
}

/* Боковые стенки замороженной ячейки - плотный кубик */
.tile.frozen .tile-front {
    background:
        linear-gradient(to bottom,
            rgba(180, 210, 240, 0.95) 0%,
            rgba(140, 180, 220, 0.9) 100%),
        radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.25) 1px, transparent 1px),
        radial-gradient(circle at 70% 60%, rgba(120, 180, 220, 0.2) 1.5px, transparent 1.5px) !important;
    background-size: 100% 100%, 400px 400px, 500px 500px;
    background-position: 0 0, 0 0, 30px 20px;
    background-repeat: no-repeat;
    border-color: rgba(120, 160, 200, 0.95) !important;
    box-shadow:
        inset 0 0 15px rgba(200, 230, 255, 0.5),
        inset 0 0 25px rgba(80, 140, 190, 0.25) !important;
}

.tile.frozen .tile-right {
    background:
        linear-gradient(to right,
            rgba(160, 195, 235, 0.9) 0%,
            rgba(130, 170, 210, 0.85) 100%),
        radial-gradient(circle at 25% 35%, rgba(255, 255, 255, 0.2) 1px, transparent 1px),
        radial-gradient(circle at 75% 65%, rgba(120, 180, 220, 0.25) 1.5px, transparent 1.5px) !important;
    background-size: 100% 100%, 400px 400px, 500px 500px;
    background-position: 0 0, 20px 10px, 40px 30px;
    background-repeat: no-repeat;
    border-color: rgba(120, 160, 200, 0.95) !important;
    box-shadow:
        inset 0 0 15px rgba(200, 230, 255, 0.4),
        inset 0 0 25px rgba(80, 140, 190, 0.3) !important;
}

/* Подсветка целевой ячейки динамическим цветом */
.tile.target-highlight .tile-top {
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--target-color) 60%, transparent) 0%,
        color-mix(in srgb, var(--target-color-dark) 40%, transparent) 50%,
        color-mix(in srgb, var(--target-color) 60%, transparent) 100%);
    border: 2px solid color-mix(in srgb, var(--target-color-light) 80%, white);
    box-shadow:
        inset 0 0 30px rgba(255, 255, 255, 0.3),
        inset 5px 5px 15px color-mix(in srgb, var(--target-color-light) 40%, transparent),
        inset -5px -5px 15px color-mix(in srgb, var(--target-color-dark) 30%, transparent),
        0 0 20px color-mix(in srgb, var(--target-color) 60%, transparent),
        0 0 40px color-mix(in srgb, var(--target-color) 30%, transparent);
}

/* Мигание целевой ячейки */
.tile.target-highlight.blinking .tile-top {
    animation: blink-target 0.5s ease-in-out infinite;
}

.tile.target-highlight .tile-front {
    background: linear-gradient(to bottom,
        color-mix(in srgb, var(--target-color) 50%, transparent) 0%,
        color-mix(in srgb, var(--target-color-dark) 40%, transparent) 100%);
    border-color: color-mix(in srgb, var(--target-color-light) 60%, transparent);
}

.tile.target-highlight .tile-right {
    background: linear-gradient(to right,
        color-mix(in srgb, var(--target-color) 50%, transparent) 0%,
        color-mix(in srgb, var(--target-color-dark) 40%, transparent) 100%);
    border-color: color-mix(in srgb, var(--target-color-light) 60%, transparent);
}

/* Занятая ячейка */
.tile.filled .tile-top {
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--fill-color) 70%, transparent) 0%,
        color-mix(in srgb, var(--fill-color-dark) 50%, transparent) 50%,
        color-mix(in srgb, var(--fill-color) 70%, transparent) 100%);
    border: 2px solid color-mix(in srgb, var(--fill-color-light) 80%, white);
    box-shadow:
        inset 0 0 20px rgba(255, 255, 255, 0.2),
        inset 3px 3px 10px color-mix(in srgb, var(--fill-color-light) 30%, transparent),
        inset -3px -3px 10px color-mix(in srgb, var(--fill-color-dark) 20%, transparent),
        0 0 10px color-mix(in srgb, var(--fill-color) 40%, transparent);
}

.tile.filled .tile-front {
    background: linear-gradient(to bottom,
        color-mix(in srgb, var(--fill-color) 60%, transparent) 0%,
        color-mix(in srgb, var(--fill-color-dark) 50%, transparent) 100%);
    border-color: color-mix(in srgb, var(--fill-color-light) 50%, transparent);
}

.tile.filled .tile-right {
    background: linear-gradient(to right,
        color-mix(in srgb, var(--fill-color) 60%, transparent) 0%,
        color-mix(in srgb, var(--fill-color-dark) 50%, transparent) 100%);
    border-color: color-mix(in srgb, var(--fill-color-light) 50%, transparent);
}

@keyframes blink-target {
    0%, 100% {
        opacity: 1;
        box-shadow:
            inset 0 0 30px rgba(255, 255, 255, 0.3),
            inset 5px 5px 15px color-mix(in srgb, var(--target-color-light) 40%, transparent),
            inset -5px -5px 15px color-mix(in srgb, var(--target-color-dark) 30%, transparent),
            0 0 30px color-mix(in srgb, var(--target-color) 80%, transparent),
            0 0 60px color-mix(in srgb, var(--target-color) 50%, transparent);
    }
    50% {
        opacity: 0.4;
        box-shadow:
            inset 0 0 15px rgba(255, 255, 255, 0.1),
            inset 3px 3px 8px color-mix(in srgb, var(--target-color-light) 20%, transparent),
            inset -3px -3px 8px color-mix(in srgb, var(--target-color-dark) 15%, transparent),
            0 0 10px color-mix(in srgb, var(--target-color) 30%, transparent),
            0 0 20px color-mix(in srgb, var(--target-color) 15%, transparent);
    }
}

.tile.target .tile-top {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.6) 0%, rgba(192, 57, 43, 0.4) 50%, rgba(231, 76, 60, 0.6) 100%);
    border: 2px solid rgba(255, 150, 150, 0.8);
    box-shadow:
        inset 0 0 30px rgba(255, 255, 255, 0.3),
        inset 5px 5px 15px rgba(255, 200, 200, 0.4),
        inset -5px -5px 15px rgba(150, 45, 34, 0.3),
        0 0 20px rgba(231, 76, 60, 0.6),
        0 0 40px rgba(231, 76, 60, 0.3);
    animation: pulse-glass 2s ease-in-out infinite;
}

.tile.active .tile-top {
    box-shadow: inset 0 0 15px rgba(255,255,255,0.2), 0 0 20px rgba(255, 165, 0, 0.8), 0 0 30px rgba(255, 140, 0, 0.5);
    border-color: #ffa500;
}

.tile.active .tile-front {
    box-shadow: 0 0 15px rgba(255, 165, 0, 0.5);
}

.tile.active .tile-right {
    box-shadow: 0 0 15px rgba(255, 165, 0, 0.5);
}

@keyframes pulse-glass {
    0%, 100% {
        box-shadow:
            inset 0 0 30px rgba(255, 255, 255, 0.3),
            inset 5px 5px 15px rgba(255, 200, 200, 0.4),
            inset -5px -5px 15px rgba(150, 45, 34, 0.3),
            0 0 20px rgba(231, 76, 60, 0.6),
            0 0 40px rgba(231, 76, 60, 0.3);
    }
    50% {
        box-shadow:
            inset 0 0 40px rgba(255, 255, 255, 0.5),
            inset 5px 5px 20px rgba(255, 200, 200, 0.6),
            inset -5px -5px 20px rgba(150, 45, 34, 0.4),
            0 0 30px rgba(231, 76, 60, 0.8),
            0 0 60px rgba(231, 76, 60, 0.5);
    }
}

.tile-front {
    position: absolute;
    width: 85px;
    height: 85px;
    background: linear-gradient(to bottom, #1a4555 0%, #0d2530 100%);
    border: 2px solid rgba(80, 150, 170, 0.9);
    border-top: none;
    transform: rotateX(-90deg) translateZ(42.5px) translateY(-42.5px);
}

.tile.target .tile-front {
    background: linear-gradient(to bottom, rgba(180, 60, 50, 0.5) 0%, rgba(120, 40, 35, 0.4) 100%);
    border-color: rgba(255, 150, 150, 0.6);
    box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.2);
}

.tile-right {
    position: absolute;
    width: 85px;
    height: 85px;
    background: linear-gradient(to right, #1e4858 0%, #0f2835 100%);
    border: 2px solid rgba(80, 150, 170, 0.9);
    border-left: none;
    transform: rotateY(90deg) translateZ(42.5px) translateX(-42.5px);
}

.tile.target .tile-right {
    background: linear-gradient(to right, rgba(180, 60, 50, 0.5) 0%, rgba(120, 40, 35, 0.4) 100%);
    border-color: rgba(255, 150, 150, 0.6);
    box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.2);
}

/* Вся платформа стеклянная */
.tile .tile-front {
    background: linear-gradient(131deg, rgb(150 220 240 / 55%) 0%, rgb(100 180 200 / 28%) 50%, rgb(150 220 240 / 15%) 100%) !important;
    border-color: rgba(150, 220, 240, 0.6) !important;
    box-shadow:
        inset 0 0 15px rgba(255, 255, 255, 0.1),
        inset -1px -1px 5px rgba(100, 180, 200, 0.2) !important;
}

.tile .tile-right {
    background: linear-gradient(135deg,
        rgba(150, 220, 240, 0.1) 0%,
        rgba(100, 180, 200, 0.05) 50%,
        rgba(150, 220, 240, 0.1) 100%) !important;
    border-color: rgba(150, 220, 240, 0.6) !important;
    box-shadow:
        inset 0 0 15px rgba(255, 255, 255, 0.1),
        inset -1px -1px 5px rgba(100, 180, 200, 0.2) !important;
}

/* Переопределяем для start-platform чтобы он был камнем а не стеклом */
.start-platform .tile-front {
    background: linear-gradient(to bottom, #3a4a5a 0%, #1a2a3a 100%) !important;
    border-color: rgba(70, 80, 90, 0.9) !important;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5) !important;
}

.start-platform .tile-right {
    background: linear-gradient(to right, #3a4a5a 0%, #1a2a3a 100%) !important;
    border-color: rgba(70, 80, 90, 0.9) !important;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5) !important;
}


.cube-container {
    position: absolute;
    width: 79px;
    height: 79px;
    transform-style: preserve-3d;
    z-index: 100;
}

.cube {
    width: 79px;
    height: 79px;
    transform-style: preserve-3d;
    transform: translateZ(126px);
    transition: transform 0.3s ease-out;
}

.cube.rolling {
    transition: transform 0.3s ease-out;
}


.cube.no-transition,
.cube.no-transition.rolling {
    transition: none !important;
}

.cube-face {
    position: absolute;
    width: 79px;
    height: 79px;
    margin: -1px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    font-weight: bold;
    border: 2px solid rgba(255,255,255,0.4);
    backface-visibility: visible;
    box-shadow:
        inset 0 0 15px rgba(255, 255, 255, 0.3),
        inset 0 0 30px rgba(0, 0, 0, 0.2);
}

.face-1 {
    background: linear-gradient(135deg,
        #3a9f5d 0%,
        #2d8a4f 25%,
        #1f6a3d 50%,
        #2d8a4f 75%,
        #3a9f5d 100%);
    transform: rotateX(-90deg) translateZ(39.5px);
    color: #fff;
}

.face-2 {
    background: linear-gradient(45deg,
        #4ab875 0%,
        #3a9f5d 30%,
        #2d8a4f 60%,
        #3a9f5d 90%,
        #4ab875 100%);
    transform: rotateX(90deg) translateZ(39.5px);
    color: #fff;
}

.face-3 {
    background: linear-gradient(180deg,
        #42aa64 0%,
        #349754 40%,
        #1f6a3d 60%,
        #2d8a4f 100%);
    transform: translateZ(39.5px);
    color: #fff;
}

.face-4 {
    background: linear-gradient(0deg,
        #42aa64 0%,
        #349754 40%,
        #1f6a3d 60%,
        #2d8a4f 100%);
    transform: rotateY(180deg) translateZ(39.5px);
    color: #fff;
}

.face-5 {
    background: linear-gradient(90deg,
        #349754 0%,
        #2d8a4f 30%,
        #1f6a3d 60%,
        #2d8a4f 100%);
    transform: rotateY(-90deg) translateZ(39.5px);
    color: #fff;
}

.face-6 {
    background: linear-gradient(-90deg,
        #42aa64 0%,
        #349754 30%,
        #1f6a3d 60%,
        #2d8a4f 100%);
    transform: rotateY(90deg) translateZ(39.5px);
    color: #fff;
}

.controls {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.controls-row {
    display: flex;
    gap: 5px;
}

.btn {
    width: 60px;
    height: 60px;
    background: linear-gradient(145deg, #2a4a6b, #1a3a5b);
    border: 2px solid #4a7a9b;
    border-radius: 12px;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    background: linear-gradient(145deg, #3a5a7b, #2a4a6b);
    transform: scale(1.05);
}

.btn:active {
    transform: scale(0.95);
    background: linear-gradient(145deg, #1a3a5b, #0a2a4b);
}

.btn-restart {
    width: 70px;
    background: linear-gradient(145deg, #4a3a6b, #3a2a5b);
    border-color: #6a5a8b;
    font-size: 1.2rem;
}

.level-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-level {
    padding: 10px 20px;
    background: linear-gradient(145deg, #2a5a4b, #1a4a3b);
    border: 2px solid #4a8a6b;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-level:hover {
    background: linear-gradient(145deg, #3a6a5b, #2a5a4b);
    transform: scale(1.05);
}

.btn-level.active {
    background: linear-gradient(145deg, #4a8a6b, #3a7a5b);
    box-shadow: 0 0 15px rgba(74, 138, 107, 0.5);
}

.win-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #2a4a7a 0%, #1a3a6a 100%);
    padding: 80px 120px;
    border-radius: 30px;
    border: 4px solid rgba(100, 200, 255, 0.6);
    box-shadow: 0 0 100px rgba(100, 200, 255, 0.5), inset 0 0 30px rgba(255, 255, 255, 0.1);
    text-align: center;
    overflow: hidden;
    overscroll-behavior: none;
    z-index: 1000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: pop-in 0.5s ease;
}

@keyframes pop-in {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.1); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.win-message h2 {
    font-size: 6rem;
    margin-bottom: 60px;
    color: #fff;
    text-shadow: 0 0 30px rgba(100, 200, 255, 0.8), 0 0 60px rgba(100, 200, 255, 0.5);
    letter-spacing: 3px;
    font-weight: 900;
}

.btn-win-levels {
    margin-top: 20px;
    padding: 20px 60px;
    background: linear-gradient(145deg, #4a9aab, #2a7a8b);
    border: 3px solid rgba(100, 200, 255, 0.8);
    border-radius: 15px;
    color: #fff;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 0 10px rgba(100, 200, 255, 0.5);
}

.btn-win-levels:hover {
    background: linear-gradient(145deg, #6abadb, #4a9aab);
    transform: scale(1.1);
    box-shadow: 0 0 40px rgba(100, 200, 255, 0.8);
}

.btn-win-levels:active {
    transform: scale(0.95);
}

.btn-restart-win {
    margin-top: 30px;
    padding: 20px 60px;
    background: linear-gradient(145deg, #3a8aab, #2a6a8b);
    border: 3px solid rgba(100, 200, 255, 0.8);
    border-radius: 15px;
    color: #fff;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 0 10px rgba(100, 200, 255, 0.5);
}

.btn-restart-win:hover {
    background: linear-gradient(145deg, #5abadb, #3a8aab);
    transform: scale(1.1);
    box-shadow: 0 0 40px rgba(100, 200, 255, 0.8);
}

.btn-restart-win:active {
    transform: scale(0.95);
}

.timer-box {
    background: rgba(231, 76, 60, 0.3) !important;
    border: 1px solid rgba(231, 76, 60, 0.5);
}

.timer-box strong {
    font-size: 1.2rem;
    min-width: 20px;
    display: inline-block;
    text-align: center;
}

.hint {
    margin-top: 20px;
    font-size: 0.9rem;
    opacity: 0.7;
    text-align: center;
}

.cube-shadow {
    position: absolute;
    width: 75px;
    height: 75px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    transform: translateZ(1px);
    filter: blur(5px);
    transition: all 0.3s ease-out;
}

.cube-shadow.hidden {
    opacity: 0;
}

/* Анимация сплющивания перед прыжком */
@keyframes squash-prepare {
    0% {
        transform: translateZ(126px) scaleZ(1) scaleX(1) scaleY(1);
    }
    100% {
        transform: translateZ(97px) scaleZ(0.6) scaleX(1.2) scaleY(1.2);
    }
}

/* Анимация прыжка */
@keyframes jump-up {
    0% {
        transform: translateZ(97px) scaleZ(0.6) scaleX(1.2) scaleY(1.2);
    }
    15% {
        transform: translateZ(150px) scaleZ(1) scaleX(1) scaleY(1);
    }
    50% {
        transform: translateZ(280px) scaleZ(1) scaleX(1) scaleY(1);
    }
    75% {
        transform: translateZ(126px) scaleZ(1) scaleX(1) scaleY(1);
    }
    85% {
        transform: translateZ(126px) scaleZ(0.6) scaleX(1.2) scaleY(1.2);
    }
    100% {
        transform: translateZ(126px) scaleZ(1) scaleX(1) scaleY(1);
    }
}

.cube.squash {
    animation: squash-prepare 0.15s ease-out forwards;
}

.cube.jumping {
    animation: jump-up 0.35s ease-in-out forwards;
}

/* Тень при сплющивании */
@keyframes shadow-squash {
    0% {
        transform: translateZ(1px) scale(1);
        opacity: 0.3;
    }
    100% {
        transform: translateZ(1px) scale(1.3);
        opacity: 0.4;
    }
}

/* Тень при прыжке */
@keyframes shadow-jump {
    0% {
        transform: translateZ(1px) scale(1.3);
        opacity: 0.4;
    }
    10% {
        transform: translateZ(1px) scale(0.5);
        opacity: 0.15;
    }
    50% {
        transform: translateZ(1px) scale(0.3);
        opacity: 0.08;
    }
    75% {
        transform: translateZ(1px) scale(1);
        opacity: 0.3;
    }
    85% {
        transform: translateZ(1px) scale(1.3);
        opacity: 0.4;
    }
    100% {
        transform: translateZ(1px) scale(1);
        opacity: 0.3;
    }
}

.cube-shadow.squash {
    animation: shadow-squash 0.15s ease-out forwards;
}

.cube-shadow.jumping {
    animation: shadow-jump 0.35s ease-in-out forwards;
}

/* Сжатие при приземлении после падения */
@keyframes land-squash-cube {
    0% {
        transform: translateZ(126px) scaleZ(1) scaleX(1) scaleY(1);
    }
    30% {
        transform: translateZ(100px) scaleZ(0.5) scaleX(1.3) scaleY(1.3);
    }
    60% {
        transform: translateZ(135px) scaleZ(1.1) scaleX(0.95) scaleY(0.95);
    }
    100% {
        transform: translateZ(126px) scaleZ(1) scaleX(1) scaleY(1);
    }
}

@keyframes land-squash-shadow {
    0% {
        transform: translateZ(1px) scale(1);
    }
    30% {
        transform: translateZ(1px) scale(1.4);
    }
    60% {
        transform: translateZ(1px) scale(0.9);
    }
    100% {
        transform: translateZ(1px) scale(1);
    }
}

.cube.land-squash {
    animation: land-squash-cube 0.3s ease-out forwards !important;
}

.cube-shadow.land-squash {
    animation: land-squash-shadow 0.3s ease-out forwards !important;
}

/* Искры при приземлении */
.impact-sparks {
    position: absolute;
    width: 84px;
    height: 84px;
    pointer-events: none;
    z-index: 50;
    overflow: visible;
    transform-style: preserve-3d;
}

.spark {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #ffff00;
    border-radius: 50%;
    left: 50%;
    top: 50%;
    margin-left: -7px;
    margin-top: -7px;
    transform-style: preserve-3d;
    transform: translateZ(85px);
    box-shadow: 0 0 20px #ffff00, 0 0 40px #ffff00, 0 0 60px #ff8800;
    filter: brightness(1.5) drop-shadow(0 0 15px #ffff00);
}

@keyframes spark-burst {
    0% {
        opacity: 1;
        transform: translateZ(85px) translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateZ(85px) translate(var(--tx), var(--ty)) scale(0.3);
    }
}

.spark.active {
    animation: spark-burst 0.5s cubic-bezier(0.1, 0.5, 0.3, 1) forwards;
}

/* Эффект стекла (блик) при касании */
.glass-effect {
    position: absolute;
    width: 120px;
    height: 120px;
    left: 50%;
    top: 50%;
    margin-left: -60px;
    margin-top: -60px;
    border-radius: 50%;
    background: radial-gradient(ellipse at 30% 30%,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(255, 255, 255, 0.6) 20%,
        rgba(255, 255, 255, 0.2) 40%,
        transparent 70%);
    transform-style: preserve-3d;
    transform: translateZ(90px);
    pointer-events: none;
    opacity: 0;
}

.glass-effect.active {
    animation: glass-flash 0.6s ease-out forwards;
}

@keyframes glass-flash {
    0% {
        opacity: 0;
        transform: translateZ(90px) scale(0.3);
    }
    20% {
        opacity: 1;
        transform: translateZ(90px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateZ(90px) scale(1.5);
    }
}

/* Статичные кубики в заполненных ячейках */
.static-cube {
    position: absolute;
    width: 79px;
    height: 79px;
    left: 3px;
    top: 3px;
    transform-style: preserve-3d;
    transform: translateZ(39.5px);
    pointer-events: none;
}

.static-cube-face {
    position: absolute;
    width: 79px;
    height: 79px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backface-visibility: visible;
}

.static-cube-face.face-top {
    transform: rotateX(90deg) translateZ(39.5px);
    /* Верхняя крышка - только рамка 2px по краям, центр прозрачный */
    background: transparent !important;
    border-width: 2px;
    box-sizing: border-box;
}

.static-cube-face.face-bottom {
    transform: rotateX(-90deg) translateZ(39.5px);
}

.static-cube-face.face-front {
    transform: translateZ(39.5px);
}

.static-cube-face.face-back {
    transform: rotateY(180deg) translateZ(39.5px);
}

.static-cube-face.face-left {
    transform: rotateY(-90deg) translateZ(39.5px);
}

.static-cube-face.face-right {
    transform: rotateY(90deg) translateZ(39.5px);
}

/* Анимация слияния кубиков в шар */
@keyframes merge-and-rise {
    0% {
        /* Кубик начинает подниматься */
        transform: translateZ(39.5px) translate(0, 0) scale(1) rotateX(0deg) rotateY(0deg);
        opacity: 1;
        filter: brightness(1) saturate(1);
    }
    15% {
        /* Начало движения к центру */
        transform: translateZ(70px) translate(calc(var(--merge-x) * 0.15), calc(var(--merge-y) * 0.15)) scale(1.1) rotateX(45deg) rotateY(45deg);
        opacity: 1;
        filter: brightness(1.15) saturate(1.1);
    }
    40% {
        /* Активное движение к центру, сплющивание */
        transform: translateZ(120px) translate(calc(var(--merge-x) * 0.6), calc(var(--merge-y) * 0.6)) scale(0.95) rotateX(180deg) rotateY(180deg);
        opacity: 1;
        filter: brightness(1.25) saturate(1.2);
    }
    65% {
        /* Почти в центре, становится шариком */
        transform: translateZ(160px) translate(var(--merge-x), var(--merge-y)) scale(0.6) rotateX(360deg) rotateY(360deg);
        opacity: 0.95;
        filter: brightness(1.3) saturate(1.3) blur(0.5px);
    }
    85% {
        /* Сильное сжатие перед исчезновением */
        transform: translateZ(170px) translate(var(--merge-x), var(--merge-y)) scale(0.3) rotateX(450deg) rotateY(450deg);
        opacity: 0.5;
        filter: brightness(1.2) saturate(0.8) blur(1px);
    }
    100% {
        /* Исчезает в виде светящегося шарика */
        transform: translateZ(200px) translate(var(--merge-x), var(--merge-y)) scale(0.05) rotateX(720deg) rotateY(720deg);
        opacity: 0;
        filter: brightness(0.3) saturate(0) blur(3px);
    }
}

.static-cube.merge-to-sphere {
    animation: merge-and-rise 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transform-origin: 50% 50% 0;
    will-change: transform, opacity, filter;
}

/* Все грани становятся сферическими при слиянии */
.static-cube.merge-to-sphere .static-cube-face {
    background: radial-gradient(circle at 30% 30%, var(--merge-color) 0%, var(--merge-color) 35%, rgba(0,0,0,0.2) 100%) !important;
    border: none !important;
    border-radius: 50% !important;
    box-shadow:
        inset -8px -8px 15px rgba(0, 0, 0, 0.6),
        inset 6px 6px 12px var(--merge-color),
        0 0 20px var(--merge-color),
        0 0 40px var(--merge-color),
        0 0 80px var(--merge-color) !important;
}

/* Поднятие кубиков из ячеек */
@keyframes rise-up {
    0% {
        transform: translateZ(39.5px) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateZ(150px) scale(1);
        opacity: 1;
    }
}

.static-cube.rise-up {
    animation: rise-up 0.4s ease-out forwards;
}

/* Анимация разлёта частиц */
@keyframes particle-burst {
    0% {
        opacity: var(--particle-opacity);
        transform: translate(0, 0) scale(1) rotateZ(0deg);
        filter: brightness(1.3);
    }
    50% {
        filter: brightness(1.0);
    }
    100% {
        opacity: 0;
        transform: translate(var(--particle-x), var(--particle-y)) scale(0.05) rotateZ(var(--particle-rotate));
        filter: brightness(0.6);
    }
}

/* Стиль частицы */
.icicle {
    position: absolute;
    width: var(--particle-size);
    height: var(--particle-size);
    left: calc(var(--particle-size) / -2);
    top: calc(var(--particle-size) / -2);
    background: radial-gradient(circle at 30% 30%,
        rgba(255, 255, 255, var(--particle-brightness)) 0%,
        rgba(150, 200, 255, 0.8) 50%,
        rgba(100, 150, 255, 0.6) 100%);
    border-radius: 50%;
    box-shadow: 0 0 var(--particle-glow) rgba(150, 200, 255, 0.8);
    animation: particle-burst var(--particle-duration) ease-out forwards;
    pointer-events: none;
}

/* Анимация свечения верхней части ячейки при клике */
@keyframes tile-top-glow {
    0% {
        filter: brightness(1.0);
        box-shadow: inset 0 0 0 0 rgba(150, 220, 240, 0.8);
    }
    50% {
        filter: brightness(1.5);
        box-shadow: inset 0 0 15px 5px rgba(150, 220, 240, 0.6);
    }
    100% {
        filter: brightness(1.0);
        box-shadow: inset 0 0 0 0 rgba(150, 220, 240, 0);
    }
}

/* Класс для свечения ячейки */
.tile-top.glow-effect {
    animation: tile-top-glow 0.6s ease-out forwards;
}

/* Отображение очков при уничтожении комбинации */
.match-points {
    font-size: 3rem;
    font-weight: bold;
    color: #ffff00;
    text-shadow:
        0 0 15px rgba(255, 255, 0, 1),
        0 0 30px rgba(255, 200, 0, 0.9),
        0 0 45px rgba(255, 100, 0, 0.7),
        0 0 60px rgba(255, 150, 0, 0.5);
    font-family: 'Arial', sans-serif;
    letter-spacing: 3px;
    animation: pointsFloat 1.2s ease-out forwards;
    white-space: nowrap;
    filter: drop-shadow(0 0 8px rgba(255, 255, 0, 0.6));
}

@keyframes pointsFloat {
    0% {
        opacity: 1;
        transform: translate(-50%, 0) scale(0.3) rotateY(0deg);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -30px) scale(1.2) rotateY(10deg);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -80px) scale(1) rotateY(0deg);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -150px) scale(0.8) rotateY(-10deg);
    }
}

/* Контейнер для снежинок */
#snowflakes {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1080px;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    overflow: hidden;
}

/* Анимация падения снежинки с волнистым движением */
@keyframes snowfall {
    0% {
        transform: translateY(-100px) translateX(0) rotateZ(0deg);
        opacity: 0;
    }
    2% {
        opacity: 1;
    }
    10% {
        transform: translateY(100px) translateX(calc(var(--sway-distance) * 0.3)) rotateZ(45deg);
    }
    25% {
        transform: translateY(250px) translateX(calc(var(--sway-distance) * 0.4)) rotateZ(120deg);
    }
    40% {
        transform: translateY(400px) translateX(calc(var(--sway-distance) * -0.3)) rotateZ(200deg);
    }
    55% {
        transform: translateY(550px) translateX(calc(var(--sway-distance) * 0.35)) rotateZ(280deg);
    }
    70% {
        transform: translateY(700px) translateX(calc(var(--sway-distance) * -0.4)) rotateZ(320deg);
    }
    85% {
        transform: translateY(850px) translateX(calc(var(--sway-distance) * 0.25)) rotateZ(350deg);
        opacity: 1;
    }
    98% {
        opacity: 0;
    }
    100% {
        transform: translateY(1100px) translateX(calc(var(--sway-distance) * 0.25)) rotateZ(360deg);
        opacity: 0;
    }
}

/* Стиль снежинки */
.snowflake {
    position: absolute;
    width: var(--snowflake-size);
    height: var(--snowflake-size);
    background: radial-gradient(circle at 30% 30%,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(220, 240, 255, 0.8) 50%,
        rgba(150, 200, 255, 0.5) 100%);
    border-radius: 50%;
    box-shadow: 0 0 var(--snowflake-glow) rgba(200, 230, 255, 0.6);
    animation: snowfall var(--fall-duration) linear var(--animation-delay) forwards;
    pointer-events: none;
}

/* Контейнер для эффекта пара при плавлении льда */
.melt-steam-container {
    position: absolute;
    pointer-events: none;
    z-index: 150;
    transform-style: preserve-3d;
}

/* Эффект пара при плавлении */
.melt-steam {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(220, 240, 255, 0.85) 40%,
        rgba(180, 220, 255, 0.5) 100%);
    box-shadow: 0 0 var(--steam-glow) rgba(200, 230, 255, 0.9),
                0 0 calc(var(--steam-glow) * 2) rgba(150, 200, 255, 0.6),
                inset 0 0 calc(var(--steam-glow) / 2) rgba(255, 255, 255, 0.7);
    animation: steamRise var(--steam-duration) ease-out var(--steam-delay) forwards;
    opacity: 0;
    transform-style: preserve-3d;
}

/* Эффект разморозки - трансформация текстуры льда в обычную ячейку с яркой подсветкой */
@keyframes defrostTexture {
    0% {
        background:
            /* Замороженный цвет */
            linear-gradient(135deg,
                rgba(180, 210, 240, 1) 0%,
                rgba(150, 190, 230, 1) 50%,
                rgba(180, 210, 240, 1) 100%),
            /* Ледяная текстура */
            radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.35) 1px, transparent 1px),
            radial-gradient(circle at 60% 70%, rgba(120, 180, 220, 0.25) 2px, transparent 2px),
            radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.25) 1.5px, transparent 1.5px),
            linear-gradient(45deg, transparent 40%, rgba(100, 140, 180, 0.2) 50%, transparent 60%);
        background-size: 100% 100%, 500px 500px, 400px 400px, 600px 600px, 100% 100%;
        background-position: 0 0, 0 0, 20px 20px, 40px 10px, 0 0;
        border-color: rgba(120, 160, 200, 0.95);
        box-shadow:
            inset 0 0 25px rgba(200, 230, 255, 0.6),
            inset 2px 2px 10px rgba(255, 255, 255, 0.4),
            inset -3px -3px 12px rgba(80, 140, 190, 0.3),
            0 0 15px rgba(150, 190, 230, 0.4),
            0 0 30px rgba(100, 160, 210, 0.2);
    }
    25% {
        box-shadow:
            inset 0 0 30px rgba(200, 230, 255, 0.8),
            inset 2px 2px 12px rgba(255, 255, 255, 0.5),
            inset -3px -3px 15px rgba(80, 140, 190, 0.4),
            0 0 20px rgba(150, 220, 255, 0.8),
            0 0 40px rgba(100, 200, 255, 0.7),
            0 0 60px rgba(150, 210, 255, 0.6);
    }
    50% {
        background:
            /* Переходной цвет - между льдом и обычной ячейкой */
            linear-gradient(135deg,
                rgba(140, 200, 240, 0.95) 0%,
                rgba(120, 180, 220, 0.9) 50%,
                rgba(140, 200, 240, 0.95) 100%),
            radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.2) 1px, transparent 1px),
            radial-gradient(circle at 60% 70%, rgba(120, 180, 220, 0.15) 2px, transparent 2px),
            radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.15) 1.5px, transparent 1.5px),
            linear-gradient(45deg, transparent 40%, rgba(80, 130, 170, 0.15) 50%, transparent 60%);
        background-size: 100% 100%, 500px 500px, 400px 400px, 600px 600px, 100% 100%;
        background-position: 0 0, 0 0, 20px 20px, 40px 10px, 0 0;
        border-color: rgba(100, 150, 190, 0.9);
        box-shadow:
            inset 0 0 25px rgba(150, 220, 255, 0.6),
            inset 2px 2px 10px rgba(200, 230, 255, 0.4),
            inset -3px -3px 12px rgba(80, 140, 190, 0.3),
            0 0 25px rgba(100, 200, 255, 0.9),
            0 0 50px rgba(100, 200, 255, 0.8),
            0 0 80px rgba(150, 210, 255, 0.5);
    }
    75% {
        box-shadow:
            inset 0 0 20px rgba(150, 200, 240, 0.4),
            inset 2px 2px 8px rgba(200, 230, 255, 0.3),
            0 0 15px rgba(100, 190, 255, 0.5),
            0 0 35px rgba(100, 200, 255, 0.3);
    }
    100% {
        background:
            /* Обычный цвет платформы */
            linear-gradient(135deg,
                rgba(100, 180, 220, 0.9) 0%,
                rgba(80, 160, 210, 0.85) 50%,
                rgba(100, 180, 220, 0.9) 100%),
            /* Обычная текстура - в 4 раза крупнее, менее заметна */
            radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.1) 2px, transparent 2px),
            radial-gradient(circle at 60% 70%, rgba(120, 180, 220, 0.08) 3px, transparent 3px),
            radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.08) 2px, transparent 2px),
            linear-gradient(45deg, transparent 40%, rgba(60, 120, 160, 0.1) 50%, transparent 60%);
        background-size: 100% 100%, 500px 500px, 400px 400px, 600px 600px, 100% 100%;
        background-position: 0 0, 0 0, 20px 20px, 40px 10px, 0 0;
        border-color: rgba(80, 140, 180, 0.8);
        box-shadow:
            inset 0 0 15px rgba(150, 200, 240, 0.2),
            inset 2px 2px 4px rgba(200, 230, 255, 0.15),
            0 0 0px rgba(100, 200, 255, 0);
    }
}

.tile.defrosting .tile-top {
    animation: defrostTexture 1.2s ease-in-out forwards;
}

.tile.defrosting .tile-front {
    animation: defrostTexture 1.2s ease-in-out forwards;
}

.tile.defrosting .tile-right {
    animation: defrostTexture 1.2s ease-in-out forwards;
}

/* Ледяные кристаллы при разморозке */
@keyframes defrostCrystal {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1) rotate(0deg);
        filter: brightness(2) blur(0px);
    }
    15% {
        opacity: 1;
        transform: translate(calc(var(--px) * 0.3), calc(var(--py) * 0.3)) scale(1.1) rotate(var(--pr));
        filter: brightness(2.2) blur(0px);
    }
    40% {
        opacity: 0.9;
        transform: translate(calc(var(--px) * 0.7), calc(var(--py) * 0.7)) scale(0.9) rotate(calc(var(--pr) * 1.2));
        filter: brightness(1.8) blur(0.5px);
    }
    70% {
        opacity: 0.5;
        transform: translate(var(--px), var(--py)) scale(0.6) rotate(calc(var(--pr) * 2));
        filter: brightness(1.2) blur(1px);
    }
    100% {
        opacity: 0;
        transform: translate(calc(var(--px) * 1.2), calc(var(--py) * 1.2)) scale(0.3) rotate(calc(var(--pr) * 3));
        filter: brightness(0.3) blur(2px);
    }
}

.defrost-crystal {
    position: absolute;
    pointer-events: none;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 1) 0%,
        rgba(220, 240, 255, 1) 30%,
        rgba(150, 210, 255, 0.95) 70%,
        rgba(100, 180, 255, 0.9) 100%);
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow:
        0 0 12px rgba(200, 240, 255, 1),
        0 0 25px rgba(150, 220, 255, 0.8),
        inset 0 0 6px rgba(255, 255, 255, 0.8),
        inset -2px -2px 4px rgba(100, 160, 220, 0.4);
    animation: defrostCrystal 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    will-change: transform, opacity;
}

@keyframes steamRise {
    0% {
        opacity: 0;
        transform: translateZ(0) translateX(0) translateY(0) scale(0.3);
        filter: blur(0px);
    }
    15% {
        opacity: 0.9;
        transform: translateZ(20px) translateX(calc(var(--steam-drift-x) * 0.2)) translateY(calc(var(--steam-drift-y) * 0.2)) scale(0.8);
        filter: blur(1px);
    }
    40% {
        opacity: 0.7;
        transform: translateZ(60px) translateX(calc(var(--steam-drift-x) * 0.5)) translateY(calc(var(--steam-drift-y) * 0.5)) scale(1.1);
        filter: blur(2px);
    }
    70% {
        opacity: 0.4;
        transform: translateZ(120px) translateX(calc(var(--steam-drift-x) * 0.8)) translateY(calc(var(--steam-drift-y) * 0.8)) scale(1.4);
        filter: blur(3px);
    }
    100% {
        opacity: 0;
        transform: translateZ(180px) translateX(var(--steam-drift-x)) translateY(var(--steam-drift-y)) scale(1.8);
        filter: blur(5px);
    }
}

/* Меню выбора уровней */
.levels-menu {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
    overflow: hidden;
    overscroll-behavior: none;
}

.levels-menu.active {
    display: flex;
}

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

.levels-container {
    background: linear-gradient(135deg, #1a3a52 0%, #1a2149 100%);
    border: 3px solid rgba(100, 200, 255, 0.5);
    border-radius: 20px;
    padding: 18px;
    max-width: 980px;
    width: 93%;
    max-height: none;
    height: auto;
    overflow: hidden;
    overflow-y: hidden;
    overscroll-behavior: none;
    box-shadow: 0 0 40px rgba(100, 200, 255, 0.3),
                0 0 80px rgba(100, 200, 255, 0.1),
                inset 0 0 20px rgba(100, 200, 255, 0.1);
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    display: flex;
    flex-direction: column;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.levels-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(100, 200, 255, 0.3);
    flex-shrink: 0;
}

.language-buttons {
    display: flex;
    gap: 10px;
}

.lang-btn {
    background: rgba(100, 200, 255, 0.2);
    border: 2px solid rgba(100, 200, 255, 0.5);
    color: #64c8ff;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 50px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lang-btn:hover {
    background: rgba(100, 200, 255, 0.35);
    border-color: rgba(100, 200, 255, 0.8);
    box-shadow: 0 0 12px rgba(100, 200, 255, 0.4);
}

.lang-btn.active {
    background: rgba(100, 200, 255, 0.5);
    border-color: rgba(100, 200, 255, 1);
    color: #fff;
    box-shadow: 0 0 15px rgba(100, 200, 255, 0.6);
    transform: scale(1.05);
}

.levels-header h1 {
    font-size: 1.6rem;
    color: #fff;
    text-shadow: 0 0 20px rgba(100, 200, 255, 0.5);
    margin: 0;
    margin-left: -162px;
    flex: 1;
    text-align: center;
    pointer-events: none;
}

#page-info {
    font-size: 2rem;
    opacity: 0.8;
}

.levels-nav-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 8px;
    flex-wrap: wrap;
}

.btn-page-nav {
    background: rgba(100, 200, 255, 0.2);
    border: 2px solid rgba(100, 200, 255, 0.5);
    color: #64c8ff;
    padding: 12px 35px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 160px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-page-nav:hover:not(:disabled) {
    background: rgba(100, 200, 255, 0.4);
    border-color: rgba(100, 200, 255, 0.8);
    box-shadow: 0 0 20px rgba(100, 200, 255, 0.6);
    transform: translateY(-3px);
    scale: 1.05;
}

.btn-page-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-close-levels-wrapper {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

.btn-close-levels {
    background: rgba(255, 100, 100, 0.2);
    border: 2px solid rgba(255, 100, 100, 0.5);
    color: #ff6464;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-levels:hover {
    background: rgba(255, 100, 100, 0.4);
    border-color: rgba(255, 100, 100, 0.8);
    box-shadow: 0 0 15px rgba(255, 100, 100, 0.5);
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    padding: 0;
    margin-bottom: 12px;
    align-content: start;
    overflow: hidden;
    overscroll-behavior: none;
}

.level-button {
    aspect-ratio: 1 / 1;
    width: 100%;
    background: linear-gradient(135deg, rgba(100, 200, 255, 0.2) 0%, rgba(50, 150, 200, 0.2) 100%);
    border: 3px solid rgba(100, 200, 255, 0.4);
    border-radius: 12px;
    color: #fff;
    touch-action: manipulation;
    overscroll-behavior: none;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(100, 200, 255, 0.2);
    min-height: 0;
}

.level-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.2) 0%, transparent 60%);
    pointer-events: none;
}

.level-button:hover:not(.locked) {
    background: linear-gradient(135deg, rgba(100, 200, 255, 0.4) 0%, rgba(50, 150, 200, 0.4) 100%);
    border-color: rgba(100, 200, 255, 0.8);
    box-shadow: 0 0 30px rgba(100, 200, 255, 0.5);
}

.level-button.locked {
    background: linear-gradient(135deg, rgba(100, 100, 100, 0.2) 0%, rgba(50, 50, 50, 0.2) 100%);
    border-color: rgba(100, 100, 100, 0.4);
    color: #888;
    cursor: not-allowed;
    box-shadow: 0 0 15px rgba(100, 100, 100, 0.2);
}

.level-number {
    font-size: 1.4rem;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(100, 200, 255, 0.5);
}

.level-status {
    font-size: 0.9rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.level-button.locked .level-status {
    color: #ff6464;
}

.level-button:not(.locked) .level-status {
    color: #64ff64;
}

.levels-footer {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-top: 12px;
    border-top: 2px solid rgba(100, 200, 255, 0.3);
    gap: 12px;
    flex-shrink: 0;
}

.page-indicators {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.page-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(100, 200, 255, 0.3);
    border: 2px solid rgba(100, 200, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-indicator.active {
    background: rgba(100, 200, 255, 0.8);
    border-color: rgba(100, 200, 255, 1);
    box-shadow: 0 0 10px rgba(100, 200, 255, 0.6);
}

.page-indicator:hover {
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(100, 200, 255, 0.5);
}

/* ==================== ЗАГРУЗОЧНЫЙ ЭКРАН ==================== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a2149 0%, #151b41 50%, #0d1233 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

/* Анимированный 3D кубик */
.loading-cube {
    width: 80px;
    height: 80px;
    position: relative;
    transform-style: preserve-3d;
    animation: loadingCubeRotate 2s infinite ease-in-out;
}

.loading-cube-face {
    position: absolute;
    width: 80px;
    height: 80px;
    border: 3px solid rgba(100, 200, 255, 0.6);
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(100, 200, 255, 0.2), rgba(50, 150, 200, 0.1));
    box-shadow:
        inset 0 0 20px rgba(100, 200, 255, 0.2),
        0 0 15px rgba(100, 200, 255, 0.3);
}

.loading-face-front  { transform: rotateY(0deg) translateZ(40px); }
.loading-face-back   { transform: rotateY(180deg) translateZ(40px); }
.loading-face-right  { transform: rotateY(90deg) translateZ(40px); }
.loading-face-left   { transform: rotateY(-90deg) translateZ(40px); }
.loading-face-top    { transform: rotateX(90deg) translateZ(40px); }
.loading-face-bottom { transform: rotateX(-90deg) translateZ(40px); }

@keyframes loadingCubeRotate {
    0% {
        transform: rotateX(-20deg) rotateY(0deg);
    }
    50% {
        transform: rotateX(-20deg) rotateY(180deg);
    }
    100% {
        transform: rotateX(-20deg) rotateY(360deg);
    }
}

/* Текст загрузки */
.loading-text {
    display: none;
}

@keyframes loadingTextPulse {
    0%, 100% {
        opacity: 1;
        text-shadow: 0 0 15px rgba(100, 200, 255, 0.6);
    }
    50% {
        opacity: 0.7;
        text-shadow: 0 0 25px rgba(100, 200, 255, 0.9);
    }
}

/* Прогресс-бар */
.loading-progress {
    width: 250px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(100, 200, 255, 0.3);
}

.loading-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4a9aab, #64c8ff, #4a9aab);
    background-size: 200% 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
    animation: loadingProgressShine 1.5s infinite linear;
}

@keyframes loadingProgressShine {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Скрываем игру до загрузки */
.game-wrapper.loading {
    opacity: 0;
    visibility: hidden;
}
