* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background: #000;
    color: white;
    min-height: 100vh;
}

body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-conic-gradient(from var(--ang, 0deg) at var(--x, 50%) var(--y, 50%), 
        #00fffc, #fc00ff, #fffc00, #00fffc 33.333%);
    mix-blend-mode: color-dodge;
    opacity: 0.05;
    z-index: -1;
    animation: bgAnimation 6s linear infinite;
}

@keyframes bgAnimation {
    to {
        --ang: 360deg;
    }
}

.header {
    text-align: center;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(45deg, #00fffc, #fc00ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(0, 255, 252, 0.5);
}

.search-container {
    text-align: center;
    padding: 2rem;
    position: relative;
}

#search-input {
    width: 600px;
    padding: 1rem 2rem;
    border-radius: 50px;
    border: 2px solid rgba(0, 255, 252, 0.3);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 255, 252, 0.2);
}

#search-input:focus {
    outline: none;
    border-color: #00fffc;
    box-shadow: 0 0 30px rgba(0, 255, 252, 0.4);
}

.game-count {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    margin: 1rem 0;
    font-size: 1.1rem;
    font-weight: 300;
    text-shadow: 0 0 10px rgba(0, 255, 252, 0.5);
}

.game-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
}

.game-card {
    background: rgba(0, 0, 0, 0.6);
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 20px rgba(0, 255, 252, 0.2);
    border: 1px solid rgba(0, 255, 252, 0.2);
    position: relative;
}

.game-card:hover {
    transform: translateY(-10px);
    box-shadow: 
        0 0 30px rgba(0, 255, 252, 0.4),
        0 0 50px rgba(252, 0, 255, 0.2);
    border-color: #00fffc;
}

.game-card:hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 15px;
    border: 2px solid #00fffc;
    box-shadow: 
        0 0 30px rgba(0, 255, 252, 0.4),
        inset 0 0 30px rgba(0, 255, 252, 0.2);
    animation: borderGlow 1.5s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes borderGlow {
    from {
        opacity: 0.5;
        box-shadow: 0 0 20px rgba(0, 255, 252, 0.3);
    }
    to {
        opacity: 1;
        box-shadow: 0 0 40px rgba(0, 255, 252, 0.6);
    }
}

.game-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    transition: transform 0.4s ease;
    filter: brightness(0.9);
}

.game-card:hover img {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.game-card h3 {
    display: none;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
}

.modal-content {
    display: flex;
    flex-direction: column;
    width: 95%;
    height: 95%;
    margin: 2.5% auto;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 255, 252, 0.3);
    border: 1px solid rgba(0, 255, 252, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    order: 2;
    border-radius: 0 0 20px 20px;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.modal-controls {
    display: flex;
    gap: 1rem;
}

.modal-button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    width: 60px;
    height: 60px;
    font-size: 1.8rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-button:hover {
    background: rgba(78, 205, 196, 0.2);
    transform: translateY(-2px);
}

.modal-frame-container {
    flex: 1;
    position: relative;
    background: #000;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
    padding: 1rem;
    order: 1;
}

#game-frame {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 15px;
    background: #000;
}

#home-particles-js {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* Add new loading animation styles */
.modal-frame-container {
    position: relative;
}

.game-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: grid;
    place-content: center;
    z-index: 10;
    transition: opacity 0.5s;
}

.game-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.game-loader .a2d {
    filter: drop-shadow(0 0 0.25em currentcolor) blur(1px);
    animation: loaderRotate 3s linear infinite;
}

.game-loader .dot {
    --not-i: calc(1 - var(--i));
    --sgn-i: calc(2*var(--i) - 1);
    --full: linear-gradient(currentcolor, currentcolor);
    margin-top: calc(var(--sgn-i)*2*2.125em);
    border: solid 1.25em transparent;
    padding: 0.25em;
    width: 2.5em;
    height: 2.5em;
    transform: rotate(calc(var(--not-i)*.5turn)) scalex(var(--sgn-i));
    background: var(--full) content-box, conic-gradient(transparent calc(var(--k0)*100%), currentcolor 0% calc(var(--k1)*100%), transparent 0%) border-box;
    --mask: var(--full) content-box, var(--full) padding-box, var(--full);
    -webkit-mask: var(--mask);
    -webkit-mask-composite: xor;
    mask: var(--mask);
    mask-composite: exclude;
    animation: dotAnim1 1.5s linear calc(var(--not-i)*-.5*1.5s) infinite,
               dotAnim2 1.5s linear calc(var(--not-i)*-.5*1.5s) infinite;
}

.game-loader .dot::before,
.game-loader .dot::after {
    content: "";
    grid-area: 1/1;
    width: 1.25em;
    height: 1.25em;
    transform: rotate(calc(var(--k, var(--k0, 0))*1turn)) translatey(-2.125em);
    opacity: calc(1000*(var(--k1) - var(--k0)));
    background: currentcolor;
}

.game-loader .dot::after {
    --k: var(--k1, .35);
}

.game-loader h1 {
    margin-top: 2em;
    color: #fff;
    font-size: 1.5em;
    filter: drop-shadow(0 0 0.25em currentcolor);
}

@keyframes loaderRotate {
    to { transform: rotate(1turn); }
}

@keyframes dotAnim1 {
    0%, 25% { --k0: 0; }
    50% { --k0: 0.65; }
    75%, 100% { --k0: 1; }
}

@keyframes dotAnim2 {
    0% { --k1: 0; }
    25% { --k1: 0.35; }
    50%, 100% { --k1: 1; }
}