/**
 * games-base.css - Body Gradient, Header & Layout
 *
 * Body gradient animation, dot overlay, scanline overlay,
 * header styling, naughty message, game grid layout,
 * floating decorative emojis, twinkling sparkles, and responsive rules.
 */

/* ========================================
   KEYFRAME ANIMATIONS — Base
   ======================================== */

@keyframes gamesGradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes dotDrift {
    0% { transform: translate(0, 0); }
    100% { transform: translate(20px, 20px); }
}

@keyframes scanlineScroll {
    0% { background-position: 0 0; }
    100% { background-position: 0 4px; }
}

@keyframes headerEntrance {
    from { opacity: 0; transform: translateY(-15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes gamesTextGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes titleGlitch {
    0%, 96%, 98.5%, 100% {
        letter-spacing: normal;
        text-shadow: 0 0 10px rgba(56, 239, 125, 0.5), 0 0 20px rgba(123, 47, 247, 0.3), 0 0 40px rgba(0, 210, 255, 0.2);
    }
    97% {
        letter-spacing: 3px;
        text-shadow: 2px 0 #ff0055, -2px 0 #00ff88, 0 0 10px rgba(56, 239, 125, 0.5);
    }
    97.5% {
        letter-spacing: -1px;
        text-shadow: -2px 0 #ff0055, 2px 0 #00ff88, 0 0 10px rgba(56, 239, 125, 0.5);
    }
    98% {
        letter-spacing: 1px;
        text-shadow: 1px 0 #ff0055, -1px 0 #00ff88, 0 0 10px rgba(56, 239, 125, 0.5);
    }
}

@keyframes floatDeco {
    0% { transform: translateY(0) translateX(0) rotate(0deg); }
    25% { transform: translateY(-30px) translateX(15px) rotate(5deg); }
    50% { transform: translateY(-10px) translateX(30px) rotate(0deg); }
    75% { transform: translateY(-40px) translateX(15px) rotate(-5deg); }
    100% { transform: translateY(0) translateX(0) rotate(0deg); }
}

@keyframes gamesTwinkle {
    0%, 100% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* ========================================
   BODY & LAYOUT
   ======================================== */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    background: #1a0533;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: calc(100% + 40px);
    height: calc(100% + 40px);
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.4) 1px, transparent 1px);
    background-size: 30px 30px;
    opacity: 0.04;
    pointer-events: none;
    z-index: 0;
    animation: dotDrift 8s linear infinite alternate;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
    animation: scanlineScroll 0.8s linear infinite;
}

/* ========================================
   HEADER
   ======================================== */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
    animation: headerEntrance 0.6s ease-out backwards;
    position: relative;
    z-index: 1;
}

h1 {
    font-size: 2.4rem;
    background: linear-gradient(45deg, #38ef7d, #00d2ff, #7b2ff7, #ff6b9d, #ffd700, #38ef7d);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gamesTextGradient 4s ease infinite, titleGlitch 12s linear infinite;
    text-shadow: 0 0 10px rgba(56, 239, 125, 0.5), 0 0 20px rgba(123, 47, 247, 0.3), 0 0 40px rgba(0, 210, 255, 0.2);
}

.back-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid white;
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: bold;
    color: white;
    border-radius: 25px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.back-btn:hover, .back-btn:active {
    background: white;
    color: #11998e;
}

/* ========================================
   NAUGHTY MESSAGE
   ======================================== */

.naughty-message {
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 20px 30px;
    margin-bottom: 30px;
    text-align: center;
    animation: headerEntrance 0.6s ease-out 0.15s backwards;
    position: relative;
    z-index: 1;
}

.naughty-message h2 {
    color: white;
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.naughty-message p {
    color: rgba(255,255,255,0.9);
    font-size: 1.1rem;
}

/* ========================================
   GAMES GRID
   ======================================== */

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* ========================================
   FLOATING DECORATIVE EMOJIS
   ======================================== */

.floating-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #0a1628 0%, #1a0533 15%, #7b2ff7 30%, #00d2ff 50%, #11998e 65%, #38ef7d 80%, #1a0533 100%);
    background-size: 400% 400%;
    animation: gamesGradientShift 15s ease infinite;
}

.floating-deco {
    position: absolute;
    opacity: 0.15;
    animation: floatDeco var(--float-duration, 20s) ease-in-out infinite;
    will-change: transform;
}

.floating-deco:nth-child(1) {
    top: 10%; left: 5%;
    font-size: 2.5rem;
    --float-duration: 18s;
    animation-delay: 0s;
}
.floating-deco:nth-child(2) {
    top: 60%; right: 8%;
    font-size: 2rem;
    --float-duration: 22s;
    animation-delay: -4s;
    opacity: 0.12;
}
.floating-deco:nth-child(3) {
    top: 25%; right: 15%;
    font-size: 3rem;
    --float-duration: 25s;
    animation-delay: -8s;
    opacity: 0.18;
}
.floating-deco:nth-child(4) {
    bottom: 15%; left: 12%;
    font-size: 1.8rem;
    --float-duration: 20s;
    animation-delay: -2s;
    opacity: 0.14;
}
.floating-deco:nth-child(5) {
    top: 45%; left: 3%;
    font-size: 2.2rem;
    --float-duration: 28s;
    animation-delay: -6s;
    opacity: 0.16;
}
.floating-deco:nth-child(6) {
    bottom: 30%; right: 5%;
    font-size: 2.8rem;
    --float-duration: 24s;
    animation-delay: -10s;
    opacity: 0.13;
}
.floating-deco:nth-child(7) {
    top: 75%; left: 40%;
    font-size: 1.6rem;
    --float-duration: 16s;
    animation-delay: -3s;
    opacity: 0.12;
}
.floating-deco:nth-child(8) {
    top: 5%; right: 35%;
    font-size: 2rem;
    --float-duration: 30s;
    animation-delay: -12s;
    opacity: 0.17;
}

/* ========================================
   TWINKLING SPARKLES
   ======================================== */

.games-sparkles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.games-sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    animation: gamesTwinkle var(--twinkle-duration, 3s) ease-in-out infinite;
    opacity: 0;
}

.games-sparkle:nth-child(1) { top: 8%; left: 15%; --twinkle-duration: 2.5s; animation-delay: 0s; }
.games-sparkle:nth-child(2) { top: 15%; right: 20%; --twinkle-duration: 3.2s; animation-delay: 0.5s; }
.games-sparkle:nth-child(3) { top: 30%; left: 8%; --twinkle-duration: 2.8s; animation-delay: 1.2s; }
.games-sparkle:nth-child(4) { top: 40%; right: 12%; --twinkle-duration: 3.5s; animation-delay: 0.8s; }
.games-sparkle:nth-child(5) { top: 55%; left: 25%; --twinkle-duration: 2.2s; animation-delay: 1.8s; }
.games-sparkle:nth-child(6) { top: 65%; right: 30%; --twinkle-duration: 4s; animation-delay: 0.3s; }
.games-sparkle:nth-child(7) { top: 78%; left: 45%; --twinkle-duration: 2.6s; animation-delay: 2.1s; }
.games-sparkle:nth-child(8) { top: 85%; right: 8%; --twinkle-duration: 3.8s; animation-delay: 1.5s; }
.games-sparkle:nth-child(9) { top: 20%; left: 50%; --twinkle-duration: 3s; animation-delay: 2.5s; }
.games-sparkle:nth-child(10) { top: 50%; right: 45%; --twinkle-duration: 2.4s; animation-delay: 0.7s; }

/* ========================================
   RESPONSIVE
   ======================================== */

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

    .naughty-message h2 {
        font-size: 1.4rem;
    }

    .floating-deco {
        font-size: 1.5rem !important;
        opacity: 0.10 !important;
    }

    .games-sparkle {
        width: 3px;
        height: 3px;
    }
}
