html, body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
}

.scene {
    width: 100%;
    height: 100%;
    position: relative;
    opacity: 0;
    animation: fadeIn 3s ease-in-out forwards;
}

/* Fade in animation for entire scene */
@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Dynamic Sky Background */
.sky-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 70%;
    z-index: 1;
    transition: background 2s ease-in-out;
}

/* Sunrise Theme */
.scene.sunrise .sky-background {
    background: linear-gradient(
        to bottom,
        #ff6b6b 0%,
        #ff8e53 20%,
        #ffa726 40%,
        #ffcc02 60%,
        #81c784 80%,
        #42a5f5 100%
    );
}

/* Midday Theme */
.scene.midday .sky-background {
    background: linear-gradient(
        to bottom,
        #87ceeb 0%,
        #87ceeb 30%,
        #b0e0e6 50%,
        #add8e6 70%,
        #87cefa 90%,
        #4682b4 100%
    );
}

/* Sunset Theme */
.scene.sunset .sky-background {
    background: linear-gradient(
        to bottom,
        #ff7b7b 0%,
        #ff9a56 20%,
        #ffad56 40%,
        #ffc947 60%,
        #87ceeb 80%,
        #4682b4 100%
    );
}

/* Night Theme */
.scene.night .sky-background {
    background: linear-gradient(
        to bottom,
        #0f0f23 0%,
        #1a1a2e 30%,
        #16213e 60%,
        #0f3460 80%,
        #0e4b99 100%
    );
}

/* Sun */
.sun {
    position: absolute;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, #ffd700 0%, #ff8c00 100%);
    border-radius: 50%;
    top: 40%;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.8);
    animation: sunGlow 4s ease-in-out infinite alternate;
    z-index: 2;
    opacity: 1;
    transition: opacity 2s ease-in-out, top 2s ease-in-out;
}

/* Hide sun at night */
.scene.night .sun {
    opacity: 0;
}

/* Adjust sun position for different times */
.scene.sunrise .sun {
    top: 50%;
}

.scene.midday .sun {
    top: 20%;
}

.scene.sunset .sun {
    top: 50%;
}

@keyframes sunGlow {
    0% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
        transform: translateX(-50%) scale(1);
    }
    100% {
        box-shadow: 0 0 60px rgba(255, 215, 0, 1);
        transform: translateX(-50%) scale(1.05);
    }
}

/* Moon */
.moon {
    position: absolute;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle at 30% 30%, #f5f5dc 0%, #e6e6fa 100%);
    border-radius: 50%;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 30px rgba(245, 245, 220, 0.6);
    z-index: 2;
    opacity: 0;
    transition: opacity 2s ease-in-out;
}

/* Show moon at night */
.scene.night .moon {
    opacity: 1;
    animation: moonGlow 6s ease-in-out infinite alternate;
}

@keyframes moonGlow {
    0% {
        box-shadow: 0 0 20px rgba(245, 245, 220, 0.4);
        transform: translateX(-50%) scale(1);
    }
    100% {
        box-shadow: 0 0 40px rgba(245, 245, 220, 0.8);
        transform: translateX(-50%) scale(1.03);
    }
}

/* Moon craters */
.moon::before {
    content: '';
    position: absolute;
    width: 15px;
    height: 15px;
    background: rgba(200, 200, 200, 0.3);
    border-radius: 50%;
    top: 25%;
    left: 40%;
    box-shadow: 
        20px 10px 0 -5px rgba(200, 200, 200, 0.2),
        -5px 25px 0 -8px rgba(200, 200, 200, 0.15),
        15px 35px 0 -6px rgba(200, 200, 200, 0.25);
}

/* Stars */
.stars {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 2;
    opacity: 0;
    transition: opacity 2s ease-in-out;
}

.scene.night .stars {
    opacity: 1;
}

.star {
    position: absolute;
    width: 3px;
    height: 3px;
    background: white;
    border-radius: 50%;
    animation: twinkle 3s ease-in-out infinite;
}

.star-1 { top: 15%; left: 20%; animation-delay: 0s; }
.star-2 { top: 25%; left: 80%; animation-delay: 1s; }
.star-3 { top: 35%; left: 15%; animation-delay: 0.5s; }
.star-4 { top: 20%; left: 60%; animation-delay: 1.5s; }
.star-5 { top: 40%; left: 85%; animation-delay: 2s; }
.star-6 { top: 10%; left: 45%; animation-delay: 0.8s; }
.star-7 { top: 30%; left: 25%; animation-delay: 1.2s; }
.star-8 { top: 45%; left: 70%; animation-delay: 1.8s; }

@keyframes twinkle {
    0%, 100% { 
        opacity: 0.3; 
        transform: scale(1);
    }
    50% { 
        opacity: 1; 
        transform: scale(1.5);
    }
}

/* Clouds */
.clouds {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 3;
}

.cloud {
    position: absolute;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50px;
    opacity: 0.7;
    transition: background 2s ease-in-out;
}

/* Night cloud styling */
.scene.night .cloud {
    background: rgba(100, 100, 120, 0.6);
}

.cloud::before,
.cloud::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50px;
}

.cloud-1 {
    width: 80px;
    height: 30px;
    top: 20%;
    left: 20%;
    animation: floatCloud 20s linear infinite;
}

.cloud-1::before {
    width: 50px;
    height: 40px;
    top: -20px;
    left: 10px;
}

.cloud-1::after {
    width: 60px;
    height: 35px;
    top: -15px;
    right: 10px;
}

.cloud-2 {
    width: 60px;
    height: 25px;
    top: 30%;
    right: 25%;
    animation: floatCloud 25s linear infinite reverse;
}

.cloud-2::before {
    width: 40px;
    height: 30px;
    top: -15px;
    left: 5px;
}

.cloud-2::after {
    width: 45px;
    height: 28px;
    top: -12px;
    right: 8px;
}

.cloud-3 {
    width: 70px;
    height: 28px;
    top: 15%;
    right: 10%;
    animation: floatCloud 60s linear infinite;
}

.cloud-3::before {
    width: 45px;
    height: 35px;
    top: -18px;
    left: 8px;
}

.cloud-3::after {
    width: 50px;
    height: 32px;
    top: -14px;
    right: 12px;
}

@keyframes floatCloud {
    0% {
        transform: translateX(-100px);
    }
    100% {
        transform: translateX(calc(100vw + 100px));
    }
}

/* Ocean */
.ocean {
    position: absolute;
    bottom: 30%;
    left: 0;
    width: 100%;
    height: 30%;
    z-index: 4;
    transition: background 2s ease-in-out;
}

/* Sunrise Ocean */
.scene.sunrise .ocean {
    background: linear-gradient(
        to bottom,
        #ff8a50 0%,
        #ff6b35 30%,
        #4682b4 70%,
        #2e5984 100%
    );
}

/* Midday Ocean */
.scene.midday .ocean {
    background: linear-gradient(
        to bottom,
        #87ceeb 0%,
        #4682b4 40%,
        #2e8b57 70%,
        #006994 100%
    );
}

/* Sunset Ocean */
.scene.sunset .ocean {
    background: linear-gradient(
        to bottom,
        #4682b4 0%,
        #2e8b57 50%,
        #006994 100%
    );
}

/* Night Ocean */
.scene.night .ocean {
    background: linear-gradient(
        to bottom,
        #1a1a2e 0%,
        #16213e 40%,
        #0f3460 70%,
        #0e2a5c 100%
    );
}

.wave {
    position: absolute;
    width: 120%;
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
}

.wave-1 {
    bottom: 60%;
    animation: wave 3s ease-in-out infinite;
}

.wave-2 {
    bottom: 40%;
    animation: wave 3s ease-in-out infinite 1s;
}

.wave-3 {
    bottom: 20%;
    animation: wave 3s ease-in-out infinite 2s;
}

@keyframes wave {
    0%, 100% {
        transform: translateX(-10%) scaleX(1);
    }
    50% {
        transform: translateX(-5%) scaleX(1.1);
    }
}

/* Beach */
.beach {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30%;
    z-index: 1000;
    transition: background 2s ease-in-out;
}

/* Scene Container for Transitions */
.scene-container {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.scene-container.slide-left {
    transform: translateX(-100%);
}

.scene-container.slide-right {
    transform: translateX(100%);
}

/* Beach Menu */
.beach-menu {
    position: absolute;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 60px;
    z-index: 15;

}

.menu-item {
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease, filter 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-height: 80px;
    text-decoration: none;
    color: inherit;
    z-index: 16;
    /* Ensure the entire area is clickable */
    padding: 10px;
    box-sizing: border-box;
}

.menu-item:hover {
    transform: translateY(-10px) scale(1.05);
    filter: brightness(1.2);
}

.menu-label {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.menu-item:hover .menu-label {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* Sunrise Beach */
.scene.sunrise .beach {
    background: linear-gradient(
        to bottom,
        #ffb347 0%,
        #f4a460 50%,
        #daa520 100%
    );
}

/* Midday Beach */
.scene.midday .beach {
    background: linear-gradient(
        to bottom,
        #f4a460 0%,
        #daa520 50%,
        #cd853f 100%
    );
}

/* Sunset Beach */
.scene.sunset .beach {
    background: linear-gradient(
        to bottom,
        #f4a460 0%,
        #daa520 50%,
        #cd853f 100%
    );
}

/* Night Beach */
.scene.night .beach {
    background: linear-gradient(
        to bottom,
        #8b7355 0%,
        #654321 50%,
        #3e2723 100%
    );
}

/* Palm Trees */
.palm-trees {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 15;
}

.palm-tree {
    position: absolute;
    bottom: 20%;
    transform-origin: bottom center;
    animation: rockTree 4s ease-in-out infinite;
}

.left-tree {
    left: 15%;
    animation-delay: 0s;
    animation-duration: 4s;
}

.right-tree {
    right: 20%;
    animation-delay: 2s;
    animation-duration: 5s;
    transform: scaleX(-1);
}

@keyframes rockTree {
    0%, 100% {
        transform: rotate(-2deg);
    }
    50% {
        transform: rotate(2deg);
    }
}

/* Tree trunk */
.trunk {
    width: 20px;
    height: 200px;
    background: linear-gradient(
        to right,
        #8b4513 0%,
        #a0522d 50%,
        #8b4513 100%
    );
    border-radius: 10px;
    position: relative;
    margin: 0 auto;
}

.trunk::before {
    content: '';
    position: absolute;
    width: 15px;
    height: 15px;
    background: #654321;
    border-radius: 50%;
    left: 50%;
    transform: translateX(-50%);
    top: 30%;
    box-shadow: 0 40px 0 #654321, 0 80px 0 #654321;
}

/* Palm fronds */
.fronds {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
}

.frond {
    position: absolute;
    width: 80px;
    height: 20px;
    background: linear-gradient(
        to right,
        #228b22 0%,
        #32cd32 20%,
        #228b22 40%,
        #32cd32 60%,
        #228b22 80%,
        #32cd32 100%
    );
    border-radius: 100px 10px 100px 10px;
    transform-origin: 10px center;
    animation: swayFrond 3s ease-in-out infinite;
    clip-path: polygon(0% 50%, 15% 0%, 85% 20%, 100% 40%, 95% 60%, 85% 80%, 15% 100%, 0% 50%);
}

.frond::before {
    content: '';
    position: absolute;
    width: 2px;
    height: 100%;
    background: #1a5a1a;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
}

.frond-1 {
    top: 50px;
    left: 50px;
    transform: rotate(-30deg);
    animation-delay: 0s;
}

.frond-2 {
    top: 50px;
    left: 50px;
    transform: rotate(0deg);
    animation-delay: 0.5s;
}

.frond-3 {
    top: 50px;
    left: 50px;
    transform: rotate(-60deg);
    animation-delay: 1s;
}

.frond-4 {
    top: 50px;
    left: 50px;
    transform: rotate(-90deg);
    animation-delay: 1.5s;
}

.frond-5 {
    top: 50px;
    left: 50px;
    transform: rotate(-120deg);
    animation-delay: 2s;
}

.frond-6 {
    top: 50px;
    left: 50px;
    transform: rotate(-150deg);
    animation-delay: 2.5s;
}

@keyframes swayFrond {
    0%, 100% {
        transform: rotate(var(--base-rotation)) translateX(0px);
    }
    50% {
        transform: rotate(var(--base-rotation)) translateX(5px);
    }
}

.frond-1 { --base-rotation: -220deg; }
.frond-2 { --base-rotation: -190deg; }
.frond-3 { --base-rotation: 0deg; }
.frond-4 { --base-rotation: 60deg; }
.frond-5 { --base-rotation: -120deg; }
.frond-6 { --base-rotation: -60deg; }

/* Enhanced rocking animation with entry effect - plays once */
@keyframes rockTree {
    0% {
        transform: rotate(-3deg) translateY(100px);
        opacity: 0;
    }
    15% {
        opacity: 1;
        transform: rotate(-2deg) translateY(0px);
    }
    30% {
        transform: rotate(2deg) translateY(0px);
    }
    45% {
        transform: rotate(-1deg) translateY(0px);
    }
    60% {
        transform: rotate(1deg) translateY(0px);
    }
    75% {
        transform: rotate(-0.5deg) translateY(0px);
    }
    100% {
        transform: rotate(0deg) translateY(0px);
    }
}

.left-tree {
    left: 15%;
    animation: rockTree 4s ease-out forwards;
    animation-delay: 1s;
}

.right-tree {
    right: 20%;
    animation: rockTree 4s ease-out forwards;
    animation-delay: 2s;
    transform: scaleX(-1);
}

/* Time Indicator */
.time-indicator {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 15px;
    border-radius: 10px;
    font-family: 'Arial', sans-serif;
    font-size: 14px;
    z-index: 15;
    display: flex;
    flex-direction: column;
    gap: 5px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.time-indicator span {
    font-weight: bold;
}

/* Testing Controls */
.testing-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px;
    border-radius: 10px;
    font-family: 'Arial', sans-serif;
    font-size: 14px;
    z-index: 15;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 200px;
}

.toggle-container {
    margin-bottom: 10px;
}

.toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: bold;
    gap: 10px;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    width: 40px;
    height: 20px;
    background: #555;
    border-radius: 10px;
    position: relative;
    transition: background 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider {
    background: #4CAF50;
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.time-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.time-selector label {
    font-weight: bold;
    font-size: 12px;
}

.time-selector select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 5px 8px;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
}

.time-selector select:focus {
    outline: none;
    border-color: #4CAF50;
}

.time-selector select option {
    background: #333;
    color: white;
}

/* Responsive design */
@media (max-width: 768px) {
    .sun {
        width: 80px;
        height: 80px;
    }
    
    .moon {
        width: 70px;
        height: 70px;
    }
    
    .trunk {
        width: 15px;
        height: 150px;
    }
    
    .frond {
        width: 60px;
        height: 12px;
    }
    
    .left-tree {
        left: 10%;
    }
    
    .right-tree {
        right: 10%;
    }
    
    .time-indicator {
        top: 10px;
        right: 10px;
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .testing-controls {
        top: 10px;
        left: 10px;
        font-size: 12px;
        padding: 10px;
        min-width: 180px;
    }
    
    .toggle-slider {
        width: 35px;
        height: 18px;
    }
    
    .toggle-slider::before {
        width: 14px;
        height: 14px;
    }
    
    .toggle-label input[type="checkbox"]:checked + .toggle-slider::before {
        transform: translateX(17px);
    }
    
    .beach-menu {
        gap: 40px;
        bottom: 12%;
    }
    
    .menu-item {
        transform: scale(0.8);
    }
    
    .menu-label {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .nav-back {
        left: 10px;
        padding: 12px;
    }
    
    .back-arrow {
        font-size: 20px;
    }
    
    .back-text {
        font-size: 10px;
    }
}

/* Sandcastle */
.sandcastle {
    width: 360px;
    height: 270px;
    position: relative;
}

.castle-tower {
    position: absolute;
    background: linear-gradient(to bottom, #f4d03f 0%, #f39c12 100%);
    border-radius: 50% 50% 0 0;
    border: 2px solid #e67e22;
}

.tower-1 {
    width: 105px;
    height: 150px;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

.tower-2 {
    width: 84px;
    height: 126px;
    top: 24px;
    left: 60px;
}

.tower-3 {
    width: 84px;
    height: 126px;
    top: 24px;
    right: 60px;
}

.castle-wall {
    position: absolute;
    bottom: 0;
    left: 15px;
    right: 15px;
    height: 30px;
    background: linear-gradient(to bottom, #f4d03f 0%, #f39c12 100%);
    border-radius: 0 0 15px 15px;
    border: 3px solid #e67e22;
}

.castle-flag {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid #e74c3c;
    border-bottom: 6px solid transparent;
    border-top: 6px solid transparent;
}

/* Bucket and Shovel */
.bucket-shovel {
    width: 80px;
    height: 60px;
    position: relative;
}

.bucket {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.bucket-body {
    width: 30px;
    height: 25px;
    background: linear-gradient(to bottom, #3498db 0%, #2980b9 100%);
    border-radius: 0 0 15px 15px;
    border: 2px solid #1f4e79;
}

.bucket-handle {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 8px;
    background: #95a5a6;
    border-radius: 4px;
}

.shovel {
    position: absolute;
    top: 0;
    right: 10px;
}

.shovel-handle {
    width: 4px;
    height: 25px;
    background: linear-gradient(to bottom, #8b4513 0%, #654321 100%);
    border-radius: 2px;
}

.shovel-blade {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 8px;
    background: #e67e22;
    border-radius: 0 0 6px 6px;
}

/* Drink Stand */
.drink-stand {
    width: 80px;
    height: 60px;
    position: relative;
}

.stand-top {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 15px;
    background: linear-gradient(to bottom, #e74c3c 0%, #c0392b 100%);
    border-radius: 20px 20px 0 0;
    border: 2px solid #a93226;
}

.stand-pole {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 25px;
    background: linear-gradient(to bottom, #8b4513 0%, #654321 100%);
    border-radius: 3px;
}

.stand-base {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 8px;
    background: linear-gradient(to bottom, #8b4513 0%, #654321 100%);
    border-radius: 4px;
}

.drink-cup {
    position: absolute;
    top: 5px;
    right: 15px;
    width: 12px;
    height: 15px;
    background: linear-gradient(to bottom, #f1c40f 0%, #f39c12 100%);
    border-radius: 0 0 6px 6px;
    border: 1px solid #e67e22;
}

.drink-cup::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 3px;
    background: #e74c3c;
    border-radius: 1.5px;
} 