/* Font Face cho Knewave */
@font-face {
    font-family: 'Knewave';
    src: url('assets/fonts/Knewave-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Font Face cho Pacifico */
@font-face {
    font-family: 'Pacifico';
    src: url('assets/fonts/Pacifico-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

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

body {
    font-family: 'Avenir', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    overflow: hidden;
    background: transparent;
    position: relative;
    width: 100vw;
    height: 100vh;
}

.body--ready {
    cursor: pointer;
}

/* Orientation Lock */
.orientation-lock {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 10002; /* Cao hơn start-overlay (10003) nhưng chỉ hiển thị sau khi click "Bắt đầu" */
    justify-content: center;
    align-items: center;
    flex-direction: column;
    visibility: visible;
    opacity: 1;
}

/* Ẩn nút phát nhạc khi orientation lock hiển thị */
.orientation-lock:not([style*="display: none"]) ~ * .music-control,
body:has(.orientation-lock:not([style*="display: none"])) .music-control {
    display: none !important;
}

.orientation-message {
    text-align: center;
    color: #00838f;
    font-size: 20px;
    padding: 20px;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    font-family: 'Pacifico', cursive;
}

.orientation-message p {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    font-family: 'Pacifico', cursive !important;
}

.rotate-icon {
    width: 120px;
    height: 120px;
    object-fit: contain;
    animation: rotate 2s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}


@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Ready Overlay */
.ready-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(135, 206, 235, 0.95) 0%, rgba(176, 224, 230, 0.95) 50%, rgba(100, 149, 237, 0.95) 100%);
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    animation: fadeIn 0.5s ease-in;
}

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

.ready-overlay-content {
    text-align: center;
    color: white;
    padding: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 90%;
}

.santa-icon {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

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

.ready-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    font-family: 'Pacifico', cursive;
}

.ready-message {
    font-size: 20px;
    margin-bottom: 30px;
    opacity: 0.9;
    font-family: 'Pacifico', cursive;
}

.ready-overlay-button {
    padding: 15px 40px;
    font-size: 18px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.4);
    font-family: 'Pacifico', cursive;
}

.ready-overlay-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.6);
    background: linear-gradient(135deg, #5BA0F2 0%, #468ACD 100%);
}

.ready-overlay-button:active {
    transform: translateY(0);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    .ready-title {
        font-size: 24px;
    }
    
    .ready-message {
        font-size: 18px;
    }
    
    .santa-icon {
        width: 60px;
        height: 60px;
    }
    
    .ready-overlay-button {
        padding: 12px 30px;
        font-size: 16px;
    }
}

/* Background Video */
.background-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    pointer-events: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Canvas */
.canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* Music Control */
.music-control {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 50px;
    height: 50px;
    background: rgba(77, 208, 225, 0.7);
    border-radius: 50%;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    cursor: pointer;
    z-index: 1000;
    font-size: 20px;
    color: #ffffff;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 188, 212, 0.4);
    line-height: 1;
    padding: 0 !important;
    margin: 0 !important;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transform: translateZ(0);
    will-change: transform;
}

.music-control::before,
.music-control::after {
    content: none;
}

.music-control * {
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
    color: #ffffff !important;
    margin: 0;
    padding: 0;
}

.music-control:hover {
    background: rgba(77, 208, 225, 0.9);
    transform: scale(1.1) !important;
}

.music-control.playing {
    background: rgba(128, 222, 234, 0.8);
}

/* Start Overlay */
.start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 25%, #80deea 50%, #4dd0e1 75%, #26c6da 100%);
    background-attachment: fixed;
    z-index: 10003; /* Cao nhất, hiển thị trước tất cả */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    opacity: 1;
    transition: opacity 0.5s ease-out;
    overflow: hidden;
}

/* Hiệu ứng tuyết rơi */
.start-overlay::before {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.8) 2px, transparent 2px),
        radial-gradient(circle at 40% 50%, rgba(255, 255, 255, 0.6) 1.5px, transparent 1.5px),
        radial-gradient(circle at 60% 50%, rgba(255, 255, 255, 0.7) 2px, transparent 2px),
        radial-gradient(circle at 80% 50%, rgba(255, 255, 255, 0.5) 1px, transparent 1px);
    background-size: 200px 200px, 150px 150px, 180px 180px, 120px 120px;
    background-position: 0 0, 50px 50px, 100px 100px, 150px 150px;
    animation: snowFall 20s linear infinite;
    pointer-events: none;
}

@keyframes snowFall {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100vh);
    }
}

/* Ẩn orientation lock khi start overlay đang hiển thị */
.start-overlay:not(.hidden) ~ #orientation-lock,
body:has(.start-overlay:not(.hidden)) #orientation-lock {
    display: none !important;
}

.start-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

.start-overlay-content {
    text-align: center;
    color: #01579b;
    padding: 4vh 5vw;
    animation: fadeInUp 0.8s ease-out;
    position: relative;
    z-index: 1;
    background: rgba(224, 247, 250, 0.4);
    backdrop-filter: blur(3px);
    border-radius: 2vh;
    box-shadow: 0 8px 32px rgba(1, 87, 155, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.6);
    max-width: 85%;
    max-height: 90vh;
    box-sizing: border-box;
}

.santa-notify-icon {
    width: 14vw;
    max-width: 150px;
    min-width: 80px;
    height: auto;
    margin-bottom: 2.5vh;
    animation: santaAnimate 2.5s ease-in-out infinite;
    filter: drop-shadow(0 4px 15px rgba(1, 87, 155, 0.3));
}

@keyframes santaAnimate {
    0%, 100% {
        transform: translateY(0) rotate(0deg) scale(1);
    }
    25% {
        transform: translateY(-8px) rotate(-2deg) scale(1.02);
    }
    50% {
        transform: translateY(-12px) rotate(0deg) scale(1.05);
    }
    75% {
        transform: translateY(-8px) rotate(2deg) scale(1.02);
    }
}

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

.start-title {
    font-size: clamp(20px, 5vw, 42px);
    font-weight: bold;
    margin-bottom: 2.5vh;
    font-family: 'Pacifico', cursive;
    color: #01579b;
    background: linear-gradient(135deg, #01579b 0%, #0277bd 50%, #0288d1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 3px 6px rgba(1, 87, 155, 0.6)) drop-shadow(0 0 10px rgba(255, 255, 255, 0.9));
    text-shadow: none;
    line-height: 1.2;
}

.start-message {
    font-size: clamp(14px, 3vw, 20px);
    margin-bottom: 3.5vh;
    font-family: 'Pacifico', cursive;
    text-shadow: 0 2px 8px rgba(255, 255, 255, 0.6);
    color: #0277bd;
    line-height: 1.3;
}

.start-button {
    background: linear-gradient(135deg, #ffffff 0%, #e0f7fa 50%, #b2ebf2 100%);
    color: #01579b;
    border: 3px solid #4dd0e1;
    padding: 2vh 5vw;
    font-size: clamp(16px, 3.5vw, 24px);
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Pacifico', cursive;
    box-shadow: 0 8px 25px rgba(1, 87, 155, 0.3), inset 0 2px 10px rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    min-width: 140px;
}

.start-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transform: rotate(45deg);
    transition: all 0.5s;
}

.start-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 35px rgba(1, 87, 155, 0.5), inset 0 2px 15px rgba(255, 255, 255, 0.9);
    border-color: #26c6da;
}

.start-button:hover::before {
    left: 100%;
}

.start-button:active {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 6px 20px rgba(1, 87, 155, 0.4), inset 0 2px 10px rgba(255, 255, 255, 0.8);
}

/* Responsive cho Start Overlay */
/* Mobile Landscape - Ưu tiên chiều cao màn hình */
@media (orientation: landscape) and (max-height: 600px) {
    .start-overlay-content {
        padding: 2.5vh 4vw;
        max-width: 88%;
        max-height: 95vh;
    }
    
    .santa-notify-icon {
        width: 10vw;
        max-width: 100px;
        min-width: 70px;
        margin-bottom: 1.5vh;
    }
    
    .start-title {
        font-size: clamp(18px, 4.5vw, 24px);
        margin-bottom: 1.5vh;
    }
    
    .start-message {
        font-size: clamp(13px, 2.8vw, 16px);
        margin-bottom: 2.5vh;
    }
    
    .start-button {
        padding: 1.5vh 4vw;
        font-size: clamp(15px, 3.2vw, 18px);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .orientation-message {
        font-size: 16px;
        font-family: 'Pacifico', cursive !important;
    }
    
    .orientation-message p {
        font-size: 18px;
        font-family: 'Pacifico', cursive !important;
    }
}


