@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

body {
    font-family: 'Press Start 2P', monospace;
    margin: 0;
    padding: 0;
    background: linear-gradient(to bottom, #65D6FE 0%, #65D6FE 50%, #8AD666 50%, #8AD666 100%);
    background-attachment: fixed;
    color: #6B4732;
    line-height: 1.5;
}

.sidecraft-dirt {
    position: fixed;
    left: 0;
    right: 0;
    top: 50%;
    height: 32px;
    background-image: repeating-linear-gradient(to right,
            #6B4732 0px, #6B4732 32px,
            #AF7E59 32px, #AF7E59 64px);
    background-size: 64px 32px;
    z-index: 0;
    image-rendering: pixelated;
    border-top: 4px solid #8AD666;
}

body::after {
    display: none;
}

.container {
    max-width: 100%;
    padding: 20px;
    text-align: center;
    position: relative;
    z-index: 1;
}

header {
    background-color: #58A83D;
    position: relative;
    padding: 30px 0;
    border-radius: 0;
    margin-bottom: 20px;
    border: 4px solid #6B4732;
    image-rendering: pixelated;
    box-shadow: 0 4px 0 #6B4732;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: repeating-linear-gradient(to right,
            rgba(0, 0, 0, 0.1) 0px, rgba(0, 0, 0, 0.1) 16px,
            rgba(0, 0, 0, 0) 16px, rgba(0, 0, 0, 0) 32px);
    background-size: 32px 32px;
    z-index: 0;
}

h1 {
    font-size: 2.5rem;
    margin: 0;
    animation: bounce 2s infinite;
    color: white;
    text-shadow:
        2px 2px 0 #6B4732,
        -2px -2px 0 #6B4732,
        2px -2px 0 #6B4732,
        -2px 2px 0 #6B4732;
    letter-spacing: 2px;
    transform-origin: center;
    position: relative;
    z-index: 1;
    -webkit-text-stroke: 1px #6B4732;
}

.cake {
    font-size: 100px;
    margin: 20px 0;
    animation: rotate 5s infinite alternate;
}

.message {
    background-color: #9B928F;
    border-radius: 0;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border: 4px solid #6B4732;
    image-rendering: pixelated;
}

.balloon {
    font-size: 40px;
    margin: 10px;
    display: inline-block;
    animation: float 3s infinite alternate;
    color: #65D6FE;
}

.balloon:nth-child(2) {
    animation-delay: 0.5s;
}

.balloon:nth-child(3) {
    animation-delay: 1s;
}

.balloon:nth-child(4) {
    animation-delay: 1.5s;
}

.balloon:nth-child(5) {
    animation-delay: 2s;
}

.confetti-container {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: -1;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0.7;
    animation: fall 5s linear infinite;
}

.age-badge {
    background-color: #71C54F;
    color: #6B4732;
    font-size: 2rem;
    font-weight: bold;
    width: 70px;
    height: 70px;
    line-height: 70px;
    border-radius: 50%;
    margin: 20px auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    animation: pulse 2s infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

.button {
    display: inline-block;
    background-color: #6B4732;
    color: #8AD666;
    padding: 15px 20px;
    border-radius: 0;
    text-decoration: none;
    margin-top: 20px;
    font-weight: bold;
    box-shadow:
        inset -4px -4px 0 0 rgba(0, 0, 0, 0.3),
        0 4px 0 0 #AF7E59;
    border: 2px solid #6B4732;
    image-rendering: pixelated;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.button:hover {
    transform: scale(1.03);
    background-color: #AF7E59;
    color: white;
}

.button:active {
    transform: translateY(4px);
    box-shadow: inset -4px -4px 0 0 rgba(0, 0, 0, 0.3);
    top: 4px;
}

.website-link {
    margin-top: 30px;
    font-size: 0.9rem;
}

.website-link a {
    color: #58A83D;
    text-decoration: none;
}

h2 {
    text-shadow: 2px 2px 0 #65D6FE;
}

.sidecraft-logo {
    width: 250px;
    height: auto;
    margin: 20px auto;
    animation: float 3s infinite alternate;
}

.sidecraft-logo img {
    width: 100%;
    height: auto;
    image-rendering: pixelated;
    filter: drop-shadow(3px 3px 0 #6B4732);
}

#birthday-box-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.5s;
    opacity: 1;
}

#birthday-box-overlay.hidden {
    display: flex;
    opacity: 0;
    pointer-events: none;
}

#birthday-box {
    width: 250px;
    height: auto;
    position: relative;
    transform-origin: center;
    text-align: center;
}

.gift-image {
    width: 100%;
    height: auto;
    transform-origin: bottom;
    transition: transform 0.5s ease-in-out, opacity 0.5s ease-in-out;
    filter: drop-shadow(0px 4px 8px rgba(0, 0, 0, 0.3));
    image-rendering: pixelated;
    cursor: pointer;
    animation: giftFloat 1.5s infinite alternate;
}

.gift-image.shake {
    animation: giftShake 0.5s ease-in-out;
}

.box-top,
.box-body,
.box-body::before,
.box-body::after {
    display: none;
}

.birthday-message {
    position: absolute;
    top: 105%;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    background-color: #9B928F;
    padding: 15px;
    border: 4px solid #6B4732;
    text-align: center;
    opacity: 0;
    transition: opacity 0.5s ease-in 0.5s, top 0.5s ease-in 0.5s;
    pointer-events: auto;
}

.birthday-message h3 {
    margin-top: 0;
    color: white;
    text-shadow: 1px 1px 0 #6B4732;
}

.birthday-message p {
    margin-bottom: 0;
}

.confetti.explosion {
    position: fixed;
    z-index: 200;
    animation: none;
    transition: opacity 0.5s ease-out;
}

#confetti-container {
    pointer-events: none;
    z-index: 200;
}

@keyframes giftFloat {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-15px);
    }
}

.explode .gift-image {
    transform: scale(1.05);
}

.explode .birthday-message {
    opacity: 0;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

@keyframes float {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-20px);
        color: #65D6FE;
    }
}

@keyframes rotate {
    from {
        transform: rotate(-5deg);
    }

    to {
        transform: rotate(5deg);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes fall {
    0% {
        transform: translateY(-100px) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-10px) rotateZ(-5deg);
    }

    40% {
        transform: translateX(10px) rotateZ(5deg);
    }

    60% {
        transform: translateX(-10px) rotateZ(-5deg);
    }

    80% {
        transform: translateX(10px) rotateZ(5deg);
    }

    100% {
        transform: translateX(0);
    }
}

@keyframes giftShake {
    0% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-20px) rotate(-5deg);
    }

    40% {
        transform: translateX(20px) rotate(5deg);
    }

    60% {
        transform: translateX(-15px) rotate(-3deg);
    }

    80% {
        transform: translateX(15px) rotate(3deg);
    }

    100% {
        transform: translateX(0);
    }
}

@keyframes confettiExplosion {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 1;
    }

    20% {
        opacity: 1;
    }

    100% {
        transform: translateY(calc(70vh - 50%)) translateX(calc(100vw - 50%)) rotate(360deg);
        opacity: 0;
    }
}

@media (max-width: 600px) {
    h1 {
        font-size: 2rem;
    }

    .cake {
        font-size: 80px;
    }

    .button {
        padding: 20px;
        margin: 30px auto;
        display: block;
        width: 90%;
        max-width: 300px;
        font-size: 0.9rem;
        box-shadow:
            inset -4px -4px 0 0 rgba(0, 0, 0, 0.3),
            0 6px 0 0 #AF7E59;
        position: relative;
        z-index: 5;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        -webkit-touch-callout: none;
    }

    .button:active,
    .button:focus {
        transform: translateY(4px);
        box-shadow: inset -4px -4px 0 0 rgba(0, 0, 0, 0.3);
        top: 4px;
        outline: none;
    }
}