* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Arial Rounded MT Bold', 'Helvetica Rounded', Arial, sans-serif;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0;
    background: #f0f0f0;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    background-size:cover;
    background-position: center;
    background-repeat: no-repeat;
}

.screen.active {
    display: flex;
}

/* Start Screen */
#start-screen {
    background-image: url('assets/start_screen.webp');
    justify-content: center;
    align-items: center;
    gap: 30px;
}

/* Placeholder background if image missing */
#start-screen:not([style*="background-image"]) {
    background-color: #ffeb3b;
}

.start-heading {
    font-family: 'Shrikhand', cursive;
    font-size: 2.8rem;
    color: #fff;
    text-shadow:
        -2px -2px 0px #7b2d00,
        4px 3px 0px #5d1f00,
        6px 6px 0px rgba(0,0,0,0.2);
    -webkit-text-stroke: 1px #7b2d00;
    text-align: center;
    padding: 20px;
    line-height: 1.4;
    animation: float 3s ease-in-out infinite;
    max-width: 90%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
}

.start-heading span {
    display: inline-block;
    animation: letter-wobble 2.5s ease-in-out infinite;
    animation-delay: var(--letter-delay, 0s);
}

.playful-btn {
    background: #ffeb3b; /* Bright Yellow */
    color: #e65100; /* Dark Orange text */
    border: 8px solid #fff;
    padding: 18px 70px;
    font-size: 2.5rem;
    border-radius: 60px;
    font-weight: 900;
    /* Multi-layered shadow for 3D effect */
    box-shadow: 
        0 12px 0px #fbc02d, 
        0 15px 30px rgba(0,0,0,0.2);
    transition: all 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    animation: pulse-btn 2s infinite;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.title-img {
    max-width: 55%;
    margin-bottom: 200px;
    transform: translateY(-30px);
    animation: float 3s ease-in-out infinite;
}

.start-btn-img {
    max-width: 15%;
    cursor: pointer;
    animation: start-btn-pulse 2s infinite;
    transition: transform 0.1s ease;
}

@keyframes start-btn-pulse {
    0% { transform: translateY(-150px) scale(1); }
    50% { transform: translateY(-150px) scale(1.05); }
    100% { transform: translateY(-150px) scale(1); }
}

.start-btn-img:active {
    transform: scale(0.95);
}

.playful-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 
        0 16px 0px #fbc02d, 
        0 20px 35px rgba(0,0,0,0.25);
    background: #fff176;
}

.playful-btn:active {
    transform: translateY(10px) scale(0.98);
    box-shadow: 
        0 2px 0px #fbc02d, 
        0 5px 10px rgba(0,0,0,0.2);
}

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

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

/* Game Screen */
#game-screen {
    background-image: url('assets/game_background_2.webp');
}

#modak-container {
    height: 45%;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    padding-right: 15%;
    position: relative;
    overflow: visible;
}

.modak-img {
    max-width: 120%;
    max-height: 120%;
    transform: translateY(-60px);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s ease;
    z-index: 10;
    animation: modak-idle 4s ease-in-out infinite;
}

@keyframes modak-idle {
    0%, 100% { transform: translateY(-60px) rotate(-0.5deg) scale(1); }
    50% { transform: translateY(-68px) rotate(0.5deg) scale(1.015); }
}

.modak-img.transitioning {
    transform: translateY(-60px) scale(0.5);
    opacity: 0;
    animation-play-state: paused;
}

.modak-img.bounce {
    animation: bounce 0.5s ease;
}

.modak-img.glow {
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.8)) brightness(1.2);
}

@keyframes bounce {
    0%, 100% { transform: translateY(-60px) scale(1); }
    50% { transform: translateY(-70px) scale(1.1); }
}

@keyframes modak-fill-pop {
    0%, 100% { transform: translateY(-60px) scale(1); }
    50% { transform: translateY(-70px) scale(1.2); }
}

#toppings-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
}

.topping {
    position: absolute;
    width: 30px;
    height: 30px;
    animation: rain 2s linear forwards;
    z-index: 25;
    pointer-events: none;
}

@keyframes rain {
    0% { transform: translateY(-100px) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* Star Trail */
.star-trail {
    position: fixed;
    font-size: 1.2rem;
    z-index: 1000;
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: star-fade 0.6s ease forwards;
}

@keyframes star-fade {
    0% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0) rotate(180deg); opacity: 0; }
}

/* Flying Filling */
.flying-filling {
    position: fixed;
    width: 60px;
    height: 60px;
    z-index: 1000;
    pointer-events: none;
    transition: all 0.8s cubic-bezier(0.6, -0.28, 0.735, 0.045);
    object-fit: contain;
}

/* Flying Hearts */
.flying-heart {
    position: fixed;
    font-size: 2rem;
    z-index: 1000;
    pointer-events: none;
    animation: fly-to-modak 1.5s ease-in forwards;
}

@keyframes fly-to-modak {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(0.5); opacity: 0; }
}

.love-glow {
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,105,180,0.6) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 5;
    opacity: 0;
    transition: opacity 1s ease;
}

.love-glow.active {
    opacity: 1;
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.3); opacity: 0.8; }
    100% { transform: scale(1); opacity: 0.6; }
}

/* UI Container */
#ui-container {
    height: 55%;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 15px 15px 20px 5%;
    z-index: 100;
}

.step-title {
    font-family: 'Kavoon', cursive;
    font-size: 4.8rem;
    font-weight: 400;
    color: #7b2d00;
    margin-bottom: 20px;
    text-shadow:
        -2px -2px 0px #fff,
        4px 3px 0px #f4a261,
        6px 6px 0px rgba(0,0,0,0.15);
    /* letter-spacing: 3px; */
    -webkit-text-stroke: 1.5px #fff;
    display: inline-block;
    align-self: center;
    animation: title-pop-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes title-pop-in {
    0% { transform: scale(0) translateY(-30px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes title-sway {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

.options-bar {
    display: flex;
    justify-content: flex-start;
    width: 100%;
    gap: 40px;
    padding-left: 20%;
    padding-top: 65px;
    align-items: flex-end;
}

.option-btn {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: transform 0.2s ease;
    animation: option-bounce-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both, option-idle-bob 2.5s ease-in-out var(--delay, 0s) infinite;
    animation-delay: var(--delay, 0s), var(--delay, 0s);
}

@keyframes option-idle-bob {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-8px) scale(1.05); }
}

.option-btn:hover .option-img-wrapper {
    animation: wiggle 0.4s ease;
}

@keyframes option-bounce-in {
    0% { transform: scale(0) translateY(40px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg) scale(1.1); }
    25% { transform: rotate(-12deg) scale(1.15); }
    75% { transform: rotate(12deg) scale(1.15); }
}

.option-img-wrapper {
    width: 120px;
    height: 120px;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    transition: transform 0.1s ease;
    animation: img-shimmer 3s ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}

@keyframes img-shimmer {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.15); }
}

.option-btn img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.option-label {
    font-family: 'Boogaloo', cursive;
    font-size: 1.2rem;
    color: #7b2d00;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 1px 1px 0px #fff;
}

.option-btn:active .option-img-wrapper {
    transform: scale(0.9);
}

#action-button-container {
    display: flex;
    justify-content: center;
    width: 80%;
    padding-left: 15%;
    padding-top: 75px;
}

.hidden {
    display: none !important;
}

.love-btn-img {
    max-width: 25%;
    cursor: pointer;
    animation: love-btn-entrance 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both, love-btn-pulse 1.5s ease-in-out 0.5s infinite;
}

.love-btn-img:active {
    transform: scale(0.95);
}

    background: #ff4081;
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.5rem;
    border-radius: 50px;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(255, 64, 129, 0.4);
    transition: transform 0.1s ease;
    cursor: pointer;
    animation: love-btn-entrance 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both, love-btn-pulse 1.5s ease-in-out 0.5s infinite;
}

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

@keyframes love-btn-entrance {
    0% { transform: scale(0) rotate(-10deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

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

/* End Screen */
#end-screen {
    background-image: url('assets/end_screen_2.webp');
    background-position: bottom;
    justify-content: flex-start;
    align-items: flex-end;
}

#end-screen:not([style*="background-image"]) {
    background-color: #e1f5fe;
}

.speech-bubble {
    position: absolute;
    top: 8%;
    left: 43%;
    max-width: 55%;
    background: #fff;
    border: 4px solid #7b2d00;
    border-radius: 30px;
    padding: 16px 22px;
    box-shadow: 4px 4px 0px #f4a261, 6px 6px 0px rgba(0,0,0,0.1);
    opacity: 0;

    transform: translateX(-65%) scale(0) rotate(-3deg);
    transform-origin: bottom right;
    transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -22px;
    right: 28px;
    border-width: 22px 0 0 14px;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
    filter: drop-shadow(2px 3px 0px #f4a261);
}

.speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -28px;
    right: 25px;
    border-width: 26px 0 0 17px;
    border-style: solid;
    border-color: #7b2d00 transparent transparent transparent;
}

.speech-bubble.show {
    opacity: 1;
    transform: translateX(-65%) scale(1) rotate(-3deg);
    animation: bubble-float 3s ease-in-out infinite;
}

@keyframes bubble-float {
    0%, 100% { transform: translateX(-65%) rotate(-3deg) translateY(0) scale(1); }
    50% { transform: translateX(-65%) rotate(-2deg) translateY(-10px) scale(1.03); }
}

.end-text {
    font-family: 'Boogaloo', cursive;
    font-size: 1.8rem;
    color: #7b2d00;
    text-align: center;
    line-height: 1.3;
    animation: text-wobble 2.5s ease-in-out infinite;
}

@keyframes text-wobble {
    0%, 100% { transform: scale(1) rotate(0deg); }
    30% { transform: scale(1.05) rotate(-1deg); }
    60% { transform: scale(1.05) rotate(1deg); }
}

/* Sparkles */
.sparkle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 10px 2px rgba(255,255,255,0.8);
    pointer-events: none;
    z-index: 30;
    animation: sparkle-anim 1s forwards;
}

@keyframes sparkle-anim {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(2) translateY(-50px); opacity: 0; }
}
