:root {
    --primary-red: #ff0000;
    --dark-red: #8e1c1c;
    --gold: #ffd700;
    --gold-shadow: #b8860b;
    --snow-white: #ffffff;
    --tree-green: #00ff00;
    --dark-green: #006400;
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 215, 0, 0.3);
    --tree-svg: url('elka.webp');
}

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

body {
    font-family: 'Comfortaa', cursive, sans-serif;
    color: var(--snow-white);
    background-color: #051405; 
    height: 100vh;
    overflow: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: -30px;
    background: url('background1.jpg') no-repeat center center fixed;
    background-size: cover;
    z-index: -2;
    pointer-events: none;
}

body.blurred-bg::before {
    filter: brightness(0.5);
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.6) 100%);
    z-index: -1;
    pointer-events: none;
}

.bg-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 80;
    transition: background 0.8s ease, opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.bg-overlay.active {
    background: rgba(0, 0, 0, 0);
    opacity: 0;
}

.bg-overlay.hidden {
    opacity: 0;
    background: rgba(0, 0, 0, 0);
}

.hidden {
    display: none !important;
}

.page {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--gold) rgba(0,0,0,0.2);
        opacity: 1;
    transform: translateX(0);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.page.hidden {
        opacity: 0;
    transform: translateX(-50px);
    pointer-events: none;
}

.page::-webkit-scrollbar {
    width: 8px;
}
.page::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}
.page::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 4px;
    border: 2px solid #8e1c1c;
}

.page-hero {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    flex-direction: column;
}

.page-grid {
        opacity: 0;
    transform: translateX(100px) scale(0.95);
    z-index: 5;
}

.page-grid:not(.hidden) {
    opacity: 1;
    transform: translateX(0) scale(1);
    animation: page2Entrance 0.8s ease-out;
    z-index: 5;
}

.page-grid.overlay-mode {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 15;
    opacity: 0;
    transform: scale(0.8);
    animation: overlayAppearance 1.5s ease-out forwards;
}

@keyframes overlayAppearance {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    50% {
        opacity: 0.7;
        transform: scale(0.95) translateY(10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes page2Entrance {
    0% {
        opacity: 0;
        transform: translateX(100px) scale(0.95);
    }
    50% {
        opacity: 0.7;
        transform: translateX(-10px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-title-3d {
    font-family: 'Rubik Gemstones', cursive;
    font-size: 8rem;
    line-height: 1.1;
    color: var(--primary-red); 
    text-transform: uppercase;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 0 15px #ffd700);
    animation: contourGlow 4s linear infinite;
}

@keyframes contourGlow {
    0% { filter: drop-shadow(0 0 8px #ffd700) drop-shadow(0 0 15px #ffd700); }
    33% { filter: drop-shadow(0 0 8px #00ff00) drop-shadow(0 0 15px #00ff00); }
    66% { filter: drop-shadow(0 0 8px #00ffff) drop-shadow(0 0 15px #00ffff); }
    100% { filter: drop-shadow(0 0 8px #ffd700) drop-shadow(0 0 15px #ffd700); }
}

.christmas-garland, .garland-lights {
    display: none;
}

@keyframes flashBulb {
    0% { opacity: 0.6; box-shadow: 0 0 5px var(--bulb-color); }
    100% { opacity: 1; box-shadow: 0 0 20px var(--bulb-color); filter: brightness(1.3); }
}

@media (max-width: 768px) {
    .hero-title-3d { font-size: 4rem; }
    .hero-title-wrapper { padding-top: 30px; }
}

.tree-gift {
    position: absolute;
    bottom: 20px;
    width: 60px;
    height: 60px;
    background-image: url('podarok.webp');
    background-size: contain;
    background-repeat: no-repeat;
    z-index: 5;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.6)) blur(2px);
    pointer-events: none;
}

.left-tree .gift-pos-1 { left: 20px; bottom: 15px; transform: rotate(-15deg); }
.left-tree .gift-pos-2 { left: 80px; bottom: 10px; transform: rotate(10deg) scale(0.85); filter: drop-shadow(0 5px 15px rgba(0,0,0,0.6)) hue-rotate(90deg) blur(2px); }
.left-tree .gift-pos-3 { left: 140px; bottom: 25px; transform: rotate(-5deg) scale(1.1); }
.left-tree .gift-pos-4 { left: 50px; bottom: 40px; transform: rotate(20deg) scale(0.7); filter: drop-shadow(0 5px 15px rgba(0,0,0,0.6)) hue-rotate(180deg) blur(2.5px); z-index: 4; }
.left-tree .gift-pos-5 { left: 110px; bottom: 15px; transform: rotate(-10deg) scale(0.9); filter: drop-shadow(0 5px 15px rgba(0,0,0,0.6)) hue-rotate(-45deg) blur(1.5px); }
.left-tree .gift-pos-6 { left: 180px; bottom: 10px; transform: rotate(15deg) scale(0.8); filter: drop-shadow(0 5px 15px rgba(0,0,0,0.6)) hue-rotate(45deg) blur(2px); }

.right-tree .gift-pos-1 { right: 20px; bottom: 15px; transform: rotate(15deg); }
.right-tree .gift-pos-2 { right: 80px; bottom: 10px; transform: rotate(-10deg) scale(0.85); filter: drop-shadow(0 5px 15px rgba(0,0,0,0.6)) hue-rotate(180deg) blur(2px); }
.right-tree .gift-pos-3 { right: 140px; bottom: 25px; transform: rotate(5deg) scale(1.1); filter: drop-shadow(0 5px 15px rgba(0,0,0,0.6)) hue-rotate(-45deg) blur(1.5px); }
.right-tree .gift-pos-4 { right: 50px; bottom: 40px; transform: rotate(-20deg) scale(0.7); filter: drop-shadow(0 5px 15px rgba(0,0,0,0.6)) hue-rotate(90deg) blur(2.5px); z-index: 4; }
.right-tree .gift-pos-5 { right: 110px; bottom: 15px; transform: rotate(10deg) scale(0.9); filter: drop-shadow(0 5px 15px rgba(0,0,0,0.6)) hue-rotate(45deg) blur(1.5px); }
.right-tree .gift-pos-6 { right: 180px; bottom: 10px; transform: rotate(-15deg) scale(0.8); filter: drop-shadow(0 5px 15px rgba(0,0,0,0.6)) hue-rotate(-90deg) blur(2px); }

@media (max-width: 768px) {
    .tree-gift { width: 40px; height: 40px; }
    .left-tree .gift-pos-2 { left: 50px; }
    .left-tree .gift-pos-3 { left: 90px; }
    .right-tree .gift-pos-2 { right: 50px; }
    .right-tree .gift-pos-3 { right: 90px; }
}

.primary-btn-3d {
    font-family: 'Rubik Gemstones', cursive;
    font-size: 2.5rem;
    padding: 1rem 5rem;
    color: var(--primary-red);
    background: linear-gradient(135deg, rgba(10, 40, 15, 0.85), rgba(20, 60, 25, 0.85));
    border: 3px solid var(--primary-red);
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 0 #051005, 0 0 25px rgba(255, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    text-transform: none;
    position: relative;
    overflow: hidden;
}

.primary-btn-3d::after {
    content: '';
    display: block;
    position: absolute;
    right: 25px;
    top: 50%; 
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background-image: url('podarok.webp');
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
        filter: brightness(1.1);
}

.primary-btn-3d::before {
    content: '';
    display: block;
    position: absolute;
    left: 25px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background-image: url('podarok.webp');
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
    filter: brightness(1.1);
}

.primary-btn-3d:hover {
    transform: translateY(4px) scale(1.05) !important; 
    box-shadow: 0 6px 0 #051005, 0 0 30px rgba(255, 0, 0, 0.25) !important;
    background: linear-gradient(135deg, rgba(15, 50, 20, 0.9), rgba(25, 70, 30, 0.9));
}

.primary-btn-3d:active {
    transform: translateY(8px) scale(1.05) !important;
    box-shadow: inset 0 4px 10px rgba(0,0,0,0.25) !important;
    background: linear-gradient(135deg, rgba(5, 20, 10, 0.9), rgba(15, 30, 15, 0.9));
    animation: buttonPulse 0.3s ease-out;
}

@keyframes buttonPulse {
    0% { transform: translateY(8px) scale(1.05); }
    50% { transform: translateY(6px) scale(1.08); }
    100% { transform: translateY(8px) scale(1.05); }
}

.top-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4rem; 
    margin: 0 auto 2rem;
    width: 100%;
}

.page2-title, .page2-progress {
    background: rgba(5, 30, 10, 0.75);
    padding: 0.8rem 3rem;
    border-radius: 50px;
    white-space: nowrap;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
}

.page2-title {
    font-family: 'Rubik Gemstones', cursive;
    font-size: 2.2rem;
    color: var(--primary-red);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.page2-progress {
    font-size: 1.6rem;
    font-family: 'Rubik Gemstones', cursive;
    color: var(--primary-red);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#selectedCount {
    color: #fff; 
    font-size: 2.2rem;
    margin: 0 5px;
    text-shadow: 0 0 5px var(--primary-red);
}

.barrel-grid {
    display: grid;
    grid-template-columns: repeat(11, 75px) !important; 
    justify-content: center;
    gap: 8px;
    max-width: 950px; 
    margin: 0 auto;
    padding: 1rem;
    padding-bottom: 40px;
    background: rgba(5, 30, 10, 0.75);
    border-radius: 40px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
    position: relative;
    z-index: 1;
}

.barrel {
    width: 75px !important;
    height: 75px !important;
    background: url('bochki.webp') no-repeat center center;
    background-size: 140%; 
    border-radius: 50%;
    overflow: visible; 
    border: none;
    position: relative;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.barrel:hover {
    transform: translateY(-8px) scale(1.08);
    z-index: 10;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

.barrel.used {
    opacity: 0.3;
}

.barrel::after, .barrel::before {
    display: none;
}

.barrel-hat {
    position: absolute;
    top: -42px;
    left: 40%; 
    transform: translateX(-50%);
    width: 230%; 
    height: 140%; 
    background-image: url('shapka.webp');
    background-size: contain;
    background-position: center bottom;
    background-repeat: no-repeat;
    z-index: 20;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.barrel:hover .barrel-hat {
    transform: translateX(-50%) translateY(-5px) scale(1.1);
}

.barrel.used .barrel-hat {
    opacity: 0.5;
    filter: grayscale(0.5) brightness(0.8);
}

.barrel-face {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.barrel-face::after {
    display: none;
}

.barrel-number {
    font-family: 'Comfortaa', cursive, sans-serif;
    font-size: 1.6rem;
    font-weight: bold;
    color: #5a0b0b;
    z-index: 2;
}

.barrel.used .barrel-number {
    color: #fff;
}

.side-tree {
    position: fixed;
    top: 0;
    height: 100vh;
    width: 35vh; 
    z-index: -1; 
    pointer-events: none;
        opacity: 0;
    visibility: hidden;
    overflow: hidden;
    transition: opacity 0.8s ease, visibility 0.8s ease;
    will-change: transform, opacity;
    }

body.show-side-trees .side-tree {
        opacity: 1;
    visibility: visible;
}

.left-tree {
    left: 0;
}

.right-tree {
    right: 0;
}

.side-tree::before {
    content: '';
    position: absolute;
    top: 0;
    height: 100vh;
    width: 70vh;
    background-image: var(--tree-svg);
    background-repeat: no-repeat;
    background-size: 100% 100%;
    opacity: 0.9;
    will-change: transform;
    filter: brightness(1.1) contrast(1.1);
    mix-blend-mode: multiply;
}

.show-side-trees .side-tree::before {
    filter: brightness(1.05) contrast(1.05);
        transform: scale(1.1);
    opacity: 0.9;
}

body.show-side-trees .page-grid .side-tree::before,
body.show-side-trees .page-song .side-tree::before {
    filter: brightness(1.05) contrast(1.05);
}

.left-tree::before {
    right: 0; 
    transform-origin: center right;
    animation: leftTreeSway 12s ease-in-out infinite alternate;
}

.right-tree::before {
    left: 0; 
    transform-origin: center left;
    animation: rightTreeSway 12s ease-in-out infinite alternate;
}

@keyframes leftTreeSway {
    0%, 100% { transform: rotate(0deg) scale(1.05); }
    50% { transform: rotate(1.2deg) scale(1.05); }
}

@keyframes rightTreeSway {
    0%, 100% { transform: rotate(0deg) scale(1.05); }
    50% { transform: rotate(-1.2deg) scale(1.05); }
}

.background-forest {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.bg-tree {
    position: absolute;
    bottom: -10px;
    width: 100px;
    height: 140px;
    background-image: var(--tree-svg);
    background-repeat: no-repeat;
    background-size: contain;
    transform-origin: bottom center;
    will-change: transform;
    filter: brightness(1.15) contrast(1.3) saturate(1.1);
}

.bg-tree::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 220%;
    height: 20px;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 80%);
    filter: blur(8px);
    z-index: -1;
}

.background-forest::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 150px;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.12), transparent);
    pointer-events: none;
    z-index: 10;
    filter: blur(15px);
}

@keyframes treeGentlySway {
    0%, 100% { transform: rotate(-2deg) scale(1); }
    50% { transform: rotate(2deg) scale(1.05); }
}

@media (max-width: 1200px) {
    .barrel-grid {
        grid-template-columns: repeat(11, 85px) !important;
        max-width: 98%;
        gap: 10px;
        padding: 1.2rem;
    }
}

@media (max-width: 768px) {
    .barrel-grid {
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 10px;
        padding: 1rem;
    }
    .hero-title-3d { font-size: 3.5rem; }
    .page2-title { font-size: 1.8rem; }
}

@media (max-width: 480px) {
    .barrel-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px;
    }
}

.page-song {
    display: flex;
    justify-content: center;
    align-items: center;
}

.song-card {
    background: rgba(142, 28, 28, 0.4);
    border-radius: 30px;
    padding: 3rem;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 
        0 0 0 10px rgba(142, 28, 28, 0.3),
        0 20px 50px rgba(0,0,0,0.6);
    position: relative;
}

.song-card::before {
    content: '';
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 80px;
    background-image: var(--tree-svg);
    background-repeat: no-repeat;
    background-size: contain;
    z-index: 10;
    mix-blend-mode: multiply;
}

.cover-wrap {
    width: 280px;
    height: 280px;
    margin: 1rem auto 2rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    overflow: hidden;
    position: relative;
}

.cover-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.cover-wrap:hover img {
    transform: scale(1.1);
}

.song-meta {
    margin-bottom: 2rem;
}

.song-number {
    font-family: 'Rubik Gemstones', cursive;
    color: var(--primary-red);
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

#songTitle {
    font-family: 'Rubik Gemstones', cursive;
    font-size: 2.5rem;
    color: var(--primary-red);
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

#songArtist {
    font-family: 'Comfortaa', sans-serif;
    font-size: 1.4rem;
    color: var(--primary-red);
}

.audio-player {
    background: rgba(0,0,0,0.3);
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.1);
}

.audio-controls-minimal {
    display: flex;
    align-items: center;
    gap: 15px;
}

.play-pause-btn-minimal {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #fff;
    border: none;
    color: var(--primary-red);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: transform 0.2s;
}

.play-pause-btn-minimal:hover {
    transform: scale(1.1);
}

.play-pause-btn-minimal svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.progress-container {
    flex-grow: 1;
}

.progress-line {
    height: 8px;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    margin-bottom: 5px;
}

.progress-fill-minimal {
    height: 100%;
    background: var(--primary-red);
    border-radius: 4px;
    width: 0%;
    position: absolute;
    top: 0;
    left: 0;
}

.progress-slider-minimal {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    top: 0;
}

.audio-time-minimal {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.7);
}

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

.popper, .popper-particle, .sparkle {
    will-change: transform, opacity;
}

.bingo-animation {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    background: url('background1.jpg') no-repeat center center;
    background-size: cover;
        opacity: 1;
    transition: opacity 1s ease;
}

.bingo-animation::after {
    content: '';
    position: absolute;
    inset: 0;
    background: black;
    opacity: 0;
    z-index: 100;
    pointer-events: none;
    transition: opacity 0.8s ease;
}

.bingo-animation.darken::after {
    opacity: 1;
}

.bingo-animation.hidden {
    display: none;
}

.bingo-text {
    font-family: 'Rubik Gemstones', cursive;
    font-size: 15vw;
    font-weight: bold;
    color: var(--primary-red);
    text-transform: uppercase;
    display: flex;
    gap: 20px;
}

.bingo-text span {
    display: inline-block;
    filter: drop-shadow(0 0 15px #ffd700);
    opacity: 0;
}

.bingo-animation:not(.hidden) .bingo-text {
    animation: flyIntoScreen 0.8s ease-in forwards;
    animation-delay: 2s; 
}

@keyframes flyIntoScreen {
    0% { 
        transform: scale(1); 
        filter: brightness(1) drop-shadow(0 0 15px #ffd700);
        opacity: 1; 
    }
    100% {
        transform: scale(10); 
        filter: brightness(2) drop-shadow(0 0 50px #ffd700);
        opacity: 0; 
    }
}

.bingo-animation:not(.hidden) .bingo-text span {
    animation: 
        assembleLetters 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards,
        contourGlow 4s linear infinite;
    animation-delay: calc(var(--i) * 0.1s), 0s;
}

@keyframes assembleLetters {
    0% {
    opacity: 0;
        transform: translate(
            calc(sin(var(--i) * 3) * 50vw), 
            calc(cos(var(--i) * 2) * 50vh)
        ) scale(0) rotate(720deg);
    }
    100% {
    opacity: 1;
        transform: translate(0, 0) scale(1) rotate(0deg);
    }
}

.bingo-snow {
    position: absolute;
    top: -10px;
    background: white;
    border-radius: 50%;
    pointer-events: none;
    z-index: 101;
    filter: blur(1px);
    animation: fall linear forwards;
}

@keyframes fall {
    to {
        transform: translateY(110vh) rotate(360deg);
    }
}
