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

body {
    overflow: hidden;
    height: 100vh;
    background-color: #f5f5f5;
    font-family: 'Arial', sans-serif;
}

.container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.message {
    font-size: 4.5rem;
    font-weight: 900;
    color: #1a1a1a;
    text-align: center;
    z-index: 10;
    letter-spacing: -1px;
    user-select: none;
    animation: angry-build 4s ease-in forwards;
}

@keyframes angry-build {
    0% {
        transform: scale(1) rotate(0deg);
        color: #1a1a1a;
        text-shadow: none;
    }
    20% {
        transform: scale(1.02) rotate(-0.3deg);
        color: #3a1a1a;
        text-shadow: 0 0 5px rgba(200, 0, 0, 0.05);
    }
    40% {
        transform: scale(1.05) rotate(0.5deg);
        color: #6a1a1a;
        text-shadow: 0 0 10px rgba(200, 0, 0, 0.1);
    }
    60% {
        transform: scale(1.08) rotate(-0.7deg);
        color: #8a1010;
        text-shadow: 0 0 15px rgba(220, 0, 0, 0.2);
    }
    75% {
        transform: scale(1.12) rotate(0.8deg);
        color: #b01010;
        text-shadow: 0 0 25px rgba(230, 0, 0, 0.3);
    }
    85% {
        transform: scale(1.15) rotate(-1deg);
        color: #cc0a0a;
        text-shadow: 0 0 35px rgba(240, 0, 0, 0.4);
    }
    92% {
        transform: scale(1.18) rotate(1.2deg);
        color: #dd0505;
        text-shadow: 0 0 40px rgba(255, 0, 0, 0.5);
    }
    100% {
        transform: scale(1.2) rotate(0deg);
        color: #e00000;
        text-shadow: 0 0 50px rgba(255, 0, 0, 0.6);
        animation: angry-shake 0.15s ease-in-out infinite;
    }
}

/* Shaking loop after the build peaks */
.message.shaking {
    color: #e00000;
    text-shadow: 0 0 50px rgba(255, 0, 0, 0.6);
    transform: scale(1.2);
    animation: angry-shake 0.1s ease-in-out infinite;
}

@keyframes angry-shake {
    0% { transform: scale(1.2) translate(0, 0) rotate(0deg); }
    25% { transform: scale(1.2) translate(-3px, 2px) rotate(-1.5deg); }
    50% { transform: scale(1.2) translate(3px, -2px) rotate(1.5deg); }
    75% { transform: scale(1.2) translate(-2px, -1px) rotate(-1deg); }
    100% { transform: scale(1.2) translate(2px, 1px) rotate(1deg); }
}

/* Freeze at angry state once shahata is triggered */
.message.still {
    animation: none;
    transform: scale(1.2);
    color: #e00000;
    text-shadow: 0 0 50px rgba(255, 0, 0, 0.6);
}

/* Shahata — starts small in center, flies at viewer */
.shahata {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.15) rotate(-10deg);
    width: 220px;
    height: auto;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
}

/* Animation is set dynamically via JS with random rotation */

.shahata.flying {
    animation: fly-shahata 0.6s cubic-bezier(0.22, 0.6, 0.36, 1) forwards;
}

.shahata.flying-fast {
    animation: fly-shahata 0.35s cubic-bezier(0.22, 0.6, 0.36, 1) forwards;
}

.shahata.flying-instant {
    animation: fly-shahata 0.18s linear forwards;
}

/* Impact flash */
.flash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    opacity: 0;
    z-index: 60;
    pointer-events: none;
}

@keyframes impact-flash {
    0% { opacity: 0; }
    15% { opacity: 1; }
    100% { opacity: 0; }
}

.flash-overlay.flash {
    animation: impact-flash 0.3s ease-out forwards;
}

/* Black screen after impact */
.black-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: black;
    opacity: 0;
    z-index: 70;
    pointer-events: none;
    transition: opacity 0.15s ease-in;
}

.black-screen.active {
    opacity: 1;
}

/* Screen crack overlay */
.crack-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 80;
    pointer-events: none;
    opacity: 0;
}

.crack-overlay img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.crack-overlay.active {
    opacity: 1;
    animation: crack-appear 0.08s ease-out forwards;
}

@keyframes crack-appear {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Sound toggle */
.sound-toggle {
    position: fixed;
    top: 15px;
    left: 15px;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 100;
    transition: transform 0.2s;
}

.sound-toggle:hover {
    transform: scale(1.1);
}

.sound-toggle img {
    width: 24px;
    height: 24px;
    position: absolute;
    opacity: 0;
    transition: opacity 0.2s;
}

.sound-toggle img.active {
    opacity: 1;
}

/* Footer */
.site-footer {
    position: fixed;
    bottom: 8px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 11px;
    color: #bbb;
    z-index: 1;
    letter-spacing: 0.5px;
}

.site-footer a {
    color: #bbb;
    text-decoration: none;
    transition: color 0.2s;
}

.site-footer a:hover {
    color: #888;
}

/* Mobile */
@media (max-width: 768px) {
    .message {
        font-size: 3rem;
        padding: 0 20px;
    }

    .shahata {
        width: 180px;
    }

    .sound-toggle {
        width: 36px;
        height: 36px;
        top: 10px;
        left: 10px;
    }

    .sound-toggle img {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .message {
        font-size: 2.2rem;
    }

    .shahata {
        width: 150px;
    }

    .sound-toggle {
        width: 32px;
        height: 32px;
        top: 8px;
        left: 8px;
    }

    .sound-toggle img {
        width: 18px;
        height: 18px;
    }
}
