@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap');

:root {
    --bg-color: #1a1a2e;
    --text-color: #e0e0e0;
    --accent-color: #ff416c; /* Bright pink/red */
    --glitch-offset-1: 3px;
    --glitch-offset-2: -3px;
    --glitch-offset-3: 5px;
    --glitch-offset-4: -5px;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Space Mono', monospace;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    text-align: center;
    perspective: 1000px; /* For 3D transformations */
}

.container {
    max-width: 800px;
    padding: 40px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 1;
}

h1 {
    font-size: 8em;
    margin: 0;
    color: var(--accent-color);
    text-shadow: 0 0 10px var(--accent-color);
    position: relative;
    display: inline-block; /* Essential for the glitch effect */
}

p {
    font-size: 1.5em;
    margin-top: 10px;
    color: var(--text-color);
}

.description {
    font-size: 1em;
    margin-top: 20px;
    line-height: 1.6;
    opacity: 0.8;
}

/* Glitch Effect - Base Styling */
#glitch-title, #glitch-text {
    position: relative;
    display: inline-block;
}

#glitch-title::before, #glitch-title::after,
#glitch-text::before, #glitch-text::after {
    content: attr(id)::before; /* Use pseudo-elements to replicate text */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    color: inherit;
    text-shadow: inherit;
}

/* Glitch Effect - Pseudo-elements */
#glitch-title::before, #glitch-text::before {
    content: attr(data-text); /* Use data-text attribute for glitch content */
    left: var(--glitch-offset-1);
    text-shadow: -2px 0 var(--accent-color);
    animation: glitch-anim-1 2s infinite alternate-reverse;
}

#glitch-title::after, #glitch-text::after {
    content: attr(data-text);
    left: var(--glitch-offset-2);
    text-shadow: 2px 0 rgb(16, 255, 0); /* Greenish tint for contrast */
    animation: glitch-anim-2 3s infinite alternate-reverse;
}

/* Glitch Effect Animations */
@keyframes glitch-anim-1 {
    0% {
        clip: rect(0, 9999px, 0, 0);
        transform: translate(0, 0);
    }
    10% {
        clip: rect(113px, 9999px, 5px, 0);
        transform: translate(-5px, 0);
    }
    20% {
        clip: rect(40px, 9999px, 120px, 0);
        transform: translate(5px, 0);
    }
    30% {
        clip: rect(70px, 9999px, 20px, 0);
        transform: translate(0, 0);
    }
    40% {
        clip: rect(100px, 9999px, 90px, 0);
        transform: translate(-3px, 0);
    }
    50% {
        clip: rect(30px, 9999px, 150px, 0);
        transform: translate(3px, 0);
    }
    60% {
        clip: rect(80px, 9999px, 60px, 0);
        transform: translate(0, 0);
    }
    70% {
        clip: rect(10px, 9999px, 110px, 0);
        transform: translate(-2px, 0);
    }
    80% {
        clip: rect(50px, 9999px, 40px, 0);
        transform: translate(2px, 0);
    }
    90% {
        clip: rect(120px, 9999px, 70px, 0);
        transform: translate(0, 0);
    }
    100% {
        clip: rect(0, 9999px, 0, 0);
        transform: translate(0, 0);
    }
}

@keyframes glitch-anim-2 {
    0% {
        clip: rect(0, 9999px, 0, 0);
        transform: translate(0, 0);
    }
    5% {
        clip: rect(70px, 9999px, 20px, 0);
        transform: translate(3px, 0);
    }
    15% {
        clip: rect(100px, 9999px, 90px, 0);
        transform: translate(-3px, 0);
    }
    25% {
        clip: rect(30px, 9999px, 150px, 0);
        transform: translate(0, 0);
    }
    35% {
        clip: rect(80px, 9999px, 60px, 0);
        transform: translate(5px, 0);
    }
    45% {
        clip: rect(10px, 9999px, 110px, 0);
        transform: translate(-5px, 0);
    }
    55% {
        clip: rect(50px, 9999px, 40px, 0);
        transform: translate(0, 0);
    }
    65% {
        clip: rect(120px, 9999px, 70px, 0);
        transform: translate(2px, 0);
    }
    75% {
        clip: rect(40px, 9999px, 120px, 0);
        transform: translate(-2px, 0);
    }
    85% {
        clip: rect(113px, 9999px, 5px, 0);
        transform: translate(0, 0);
    }
    100% {
        clip: rect(0, 9999px, 0, 0);
        transform: translate(0, 0);
    }
}


/* Lost Character Animation */
.lost-character {
    width: 60px;
    height: 80px;
    margin: 40px auto 20px;
    position: relative;
    animation: float 4s ease-in-out infinite alternate;
}

.head {
    width: 30px;
    height: 30px;
    background-color: var(--accent-color);
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 15px;
}

.body {
    width: 40px;
    height: 35px;
    background-color: var(--text-color);
    border-radius: 15px;
    position: absolute;
    top: 30px;
    left: 10px;
}

.legs {
    width: 30px;
    height: 10px;
    background-color: var(--accent-color);
    position: absolute;
    top: 65px;
    left: 15px;
    border-radius: 5px;
}

@keyframes float {
    0% {
        transform: translateY(0) rotateY(0deg);
    }
    50% {
        transform: translateY(-15px) rotateY(360deg);
    }
    100% {
        transform: translateY(0) rotateY(0deg);
    }
}

.home-button {
    display: inline-block;
    margin-top: 30px;
    padding: 12px 25px;
    background-color: var(--accent-color);
    color: var(--bg-color);
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s ease, transform 0.3s ease;
    font-weight: bold;
}

.home-button:hover {
    background-color: #ff6b9a; /* Lighter accent on hover */
    transform: scale(1.05);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    h1 {
        font-size: 5em;
    }
    p {
        font-size: 1.2em;
    }
    .container {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 3.5em;
    }
    p {
        font-size: 1em;
    }
    .lost-character {
        transform: scale(0.8);
    }
}