html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(0deg, rgba(0, 0, 0, 0.1) 1px, transparent 1px);
    background-size: 100% 3px;
    pointer-events: none;
    z-index: 100;
    opacity: 0.8;
}

.crt-header {
    animation: flicker 2s infinite, glitch 10s infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 0.98; }
    50% { opacity: 1; }
}

@keyframes glitch {
    0%, 90% { transform: translate(0); }
    92% { transform: translate(1px, -1px); }
    94% { transform: translate(-1px, 1px); }
    96% { transform: translate(0); }
}

/* BORDES RETRO CORREGIDOS PARA ALTO CONTRASTE EN MODO OSCURO */
.retro-border {
    border: 3px solid;
    border-color: #666 #111 #111 #666;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.9);
}

@media (min-width: 640px) {
    .retro-border {
        border-width: 4px;
        box-shadow: 6px 6px 0px rgba(0, 0, 0, 0.9);
    }
}

.dark .retro-border {
    border-color: #888 #222 #222 #888;
    box-shadow: 4px 4px 0px rgba(255, 255, 255, 0.15);
}

@media (min-width: 640px) {
    .dark .retro-border {
        box-shadow: 6px 6px 0px rgba(255, 255, 255, 0.15);
    }
}

.pixel-grid-overlay {
    background-image: 
        linear-gradient(to right, rgba(0, 0, 0, 0.4) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.4) 1px, transparent 1px);
    background-size: 16px 16px;
}

#pixel-canvas {
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* BOTONES RETRO CORREGIDOS EN MODO OSCURO */
.retro-button {
    border: 3px solid;
    border-color: #888 #222 #222 #888;
    position: relative;
    transform: translate(0);
    transition: all 0.1s steps(2);
}

.retro-button:active:not(:disabled) {
    border-color: #222 #888 #888 #222;
    transform: translate(3px, 3px);
    box-shadow: 1px 1px 0px rgba(0, 0, 0, 1);
}

.dark .retro-button {
    border-color: #aaa #333 #333 #aaa;
}

.dark .retro-button:active:not(:disabled) {
    border-color: #333 #aaa #aaa #333;
}

body {
    transition: background-color 0.1s steps(2);
}

.arcade-scrollbar::-webkit-scrollbar {
    width: 8px;
}
.arcade-scrollbar::-webkit-scrollbar-track {
    background: #000;
}
.arcade-scrollbar::-webkit-scrollbar-thumb {
    background: #00ff00;
    border: 2px solid #000;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}
.animate-shake {
    animation: shake 0.4s ease-in-out;
}

/* Agregado para animaciones de entrada */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fadeIn {
    animation: fadeIn 0.4s ease-out;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.animate-bounce {
    animation: bounce 1.5s infinite;
}

/* Animación de brillo para badges de victoria */
@keyframes shine-effect {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.badge-shine {
    position: relative;
    overflow: hidden;
}

.badge-shine::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0) 100%);
    animation: shine-effect 2s infinite linear;
}

/* Fondos Retro para Tarjetas */
.bg-grid-magenta {
    background-image:
        linear-gradient(rgba(255, 0, 255, 0.15) 1px, transparent 1px),
        linear-gradient(to right, rgba(255, 0, 255, 0.15) 1px, transparent 1px);
    background-size: 20px 20px;
}

.bg-dots-lime {
    background-image: radial-gradient(rgba(0, 255, 0, 0.2) 1px, transparent 1px);
    background-size: 10px 10px;
}

.bg-lines-cyan {
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(0, 255, 255, 0.1) 10px,
        rgba(0, 255, 255, 0.1) 20px
    );
}

.bg-check-yellow {
    background-color: #1a1a1a;
    background-image:
        linear-gradient(45deg, rgba(250, 204, 21, 0.1) 25%, transparent 25%, transparent 75%, rgba(250, 204, 21, 0.1) 75%, rgba(250, 204, 21, 0.1)),
        linear-gradient(45deg, rgba(250, 204, 21, 0.1) 25%, transparent 25%, transparent 75%, rgba(250, 204, 21, 0.1) 75%, rgba(250, 204, 21, 0.1));
    background-size: 30px 30px;
    background-position: 0 0, 15px 15px;
}

.bg-grid-orange {
    background-image:
        linear-gradient(rgba(249, 115, 22, 0.15) 1px, transparent 1px),
        linear-gradient(to right, rgba(249, 115, 22, 0.15) 1px, transparent 1px);
    background-size: 20px 20px;
}

.bg-dots-purple {
    background-image: radial-gradient(rgba(168, 85, 247, 0.2) 1px, transparent 1px);
    background-size: 10px 10px;
}

.bg-lines-red {
    background: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 8px,
        rgba(239, 68, 68, 0.1) 8px,
        rgba(239, 68, 68, 0.1) 16px
    );
}

.bg-lines-blue {
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 12px,
        rgba(59, 130, 246, 0.1) 12px,
        rgba(59, 130, 246, 0.1) 24px
    );
}

.bg-dots-gray {
    background-image: radial-gradient(rgba(156, 163, 175, 0.2) 1px, transparent 1px);
    background-size: 12px 12px;
}

/* Fondos Radiales para Tarjetas */
.bg-radial-magenta {
    background-image: radial-gradient(circle at center, rgba(255, 0, 255, 0.15) 0%, #000000 70%);
}
.bg-radial-lime {
    background-image: radial-gradient(circle at center, rgba(0, 255, 0, 0.15) 0%, #000000 70%);
}
.bg-radial-cyan {
    background-image: radial-gradient(circle at center, rgba(0, 255, 255, 0.15) 0%, #000000 70%);
}
.bg-radial-yellow {
    background-image: radial-gradient(circle at center, rgba(250, 204, 21, 0.2) 0%, #000000 70%);
}
.bg-radial-orange {
    background-image: radial-gradient(circle at center, rgba(249, 115, 22, 0.15) 0%, #000000 70%);
}
.bg-radial-purple {
    background-image: radial-gradient(circle at center, rgba(168, 85, 247, 0.15) 0%, #000000 70%);
}
.bg-radial-red {
    background-image: radial-gradient(circle at center, rgba(239, 68, 68, 0.15) 0%, #000000 70%);
}
.bg-radial-blue {
    background-image: radial-gradient(circle at center, rgba(59, 130, 246, 0.15) 0%, #000000 70%);
}
.bg-radial-gray {
    background-image: radial-gradient(circle at center, rgba(107, 114, 128, 0.15) 0%, #000000 70%);
}

@keyframes pulse-slow {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.4;
    }
}

.animate-pulse-slow {
    animation: pulse-slow 5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.group:hover .animate-pulse-slow {
    animation: none;
}

/* Banner de Anuncios Responsivo */
.banner-ad-container {
    width: 100%;
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: hidden;
    margin: 1rem 0;
    min-height: 60px;
}

.banner-ad-scaler {
    width: 468px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    transform-origin: top center;
    flex-shrink: 0;
}

.banner-ad-scaler script {
    display: none !important;
}

.banner-ad-scaler iframe {
    max-width: none !important;
    display: block !important;
    margin: 0 auto !important;
}

@media (max-width: 499px) {
    .banner-ad-container {
        min-height: unset;
    }
}