/* CRT Screen Effect - Enhanced Pixel Art Version */

.crt-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, #0a0a12 0%, #000 100%);
    overflow: hidden;
    perspective: var(--perspective);
}

.crt-screen {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100vh;
    background: var(--bg-dark);
    overflow: hidden;
    /* Subtle CRT curve - 2.5D effect */
    transform-style: preserve-3d;
    box-shadow:
        inset 0 0 100px rgba(0, 0, 0, 0.5),
        inset 0 0 50px rgba(37, 99, 235, 0.05),
        0 0 80px rgba(37, 99, 235, 0.15);
}

/* Scanlines - Pixel Perfect */
.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15) 0px,
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 3px
    );
    animation: scanline-flicker 0.1s infinite;
}

@keyframes scanline-flicker {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 1; }
}

/* CRT Glow Effect */
.crt-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    background: radial-gradient(
        ellipse at 50% 50%,
        rgba(37, 99, 235, 0.03) 0%,
        rgba(37, 99, 235, 0.01) 40%,
        transparent 70%
    );
}

/* Vignette Effect */
.crt-screen::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 998;
    background: radial-gradient(
        ellipse at 50% 50%,
        transparent 50%,
        rgba(0, 0, 0, 0.4) 100%
    );
}

/* Pixel Grid Overlay - Subtle */
.crt-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 997;
    background-image: 
        linear-gradient(rgba(255,255,255,0.01) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.01) 1px, transparent 1px);
    background-size: 4px 4px;
    opacity: 0.5;
}

/* Game Screens */
.game-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

.game-screen.active {
    display: flex;
}

/* Screen Transitions */
.screen-enter {
    animation: screen-slide-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.screen-exit {
    animation: screen-slide-out 0.3s ease forwards;
}

@keyframes screen-slide-in {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes screen-slide-out {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-20px) scale(0.98);
    }
}

/* RGB Split Effect on Important Elements */
.rgb-split {
    position: relative;
}

.rgb-split::before,
.rgb-split::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

.rgb-split::before {
    color: #ff0000;
    transform: translateX(-2px);
    mix-blend-mode: screen;
}

.rgb-split::after {
    color: #00ffff;
    transform: translateX(2px);
    mix-blend-mode: screen;
}

/* Flicker Effect for Dramatic Moments */
.flicker {
    animation: flicker 0.15s infinite;
}

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

/* Neon Glow for Interactive Elements */
.neon-glow {
    text-shadow:
        0 0 5px currentColor,
        0 0 10px currentColor,
        0 0 20px currentColor,
        0 0 40px currentColor;
}

/* Static Noise Effect (for transitions) */
.static-noise {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2000;
    opacity: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    mix-blend-mode: overlay;
}

.static-noise.active {
    animation: static-flash 0.2s ease;
}

@keyframes static-flash {
    0% { opacity: 0; }
    20% { opacity: 0.3; }
    40% { opacity: 0.1; }
    60% { opacity: 0.4; }
    80% { opacity: 0.1; }
    100% { opacity: 0; }
}

/* Boot Screen Effect */
.boot-sequence {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    animation: boot-fade 2s ease forwards;
}

@keyframes boot-fade {
    0%, 80% { opacity: 1; }
    100% { opacity: 0; pointer-events: none; }
}

/* Phosphor Glow */
.phosphor {
    filter: drop-shadow(0 0 2px var(--blue-glow));
}

/* ==================== PACHINKO EFFECTS ==================== */

/* Ball/Chip particle container */
.particle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1500;
    overflow: hidden;
}

/* Pachinko ball particle */
.pachinko-ball {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #ffd700 0%, #daa520 40%, #b8860b 100%);
    box-shadow:
        inset -3px -3px 6px rgba(0,0,0,0.3),
        inset 3px 3px 6px rgba(255,255,255,0.4),
        0 0 10px rgba(255,215,0,0.5);
    animation: ball-drop 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes ball-drop {
    0% {
        transform: translateY(-50px) rotate(0deg);
        opacity: 1;
    }
    20% {
        transform: translateY(100px) rotate(180deg);
    }
    40% {
        transform: translateY(80px) rotate(360deg);
    }
    60% {
        transform: translateY(120px) rotate(540deg);
    }
    80% {
        transform: translateY(100px) rotate(720deg);
    }
    100% {
        transform: translateY(calc(100vh + 50px)) rotate(1080deg);
        opacity: 0;
    }
}

/* Chip cascade effect */
.chip-particle {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue-light) 0%, var(--blue-medium) 100%);
    box-shadow:
        inset -2px -2px 4px rgba(0,0,0,0.3),
        inset 2px 2px 4px rgba(255,255,255,0.3),
        0 0 8px var(--blue-glow);
    animation: chip-fall 1s ease-out forwards;
}

.chip-particle.gold {
    background: linear-gradient(135deg, #ffd700 0%, #f59e0b 100%);
    box-shadow:
        inset -2px -2px 4px rgba(0,0,0,0.3),
        inset 2px 2px 4px rgba(255,255,255,0.5),
        0 0 10px rgba(255,215,0,0.6);
}

.chip-particle.hearts { background: linear-gradient(135deg, #ef4444, #dc2626); }
.chip-particle.diamonds { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.chip-particle.clubs { background: linear-gradient(135deg, #22c55e, #16a34a); }
.chip-particle.spades { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }

@keyframes chip-fall {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateY(200px) rotate(720deg) scale(0.5);
        opacity: 0;
    }
}

/* Line clear flash effect */
.line-flash {
    position: absolute;
    pointer-events: none;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(59, 130, 246, 0.8) 50%,
        transparent 100%);
    height: 100%;
    width: 200%;
    animation: flash-sweep 0.3s ease-out forwards;
}

@keyframes flash-sweep {
    0% {
        transform: translateX(-100%);
        opacity: 1;
    }
    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Score burst effect */
.score-burst {
    position: fixed;
    pointer-events: none;
    z-index: 1600;
    animation: burst-expand 0.6s ease-out forwards;
}

.score-burst::before {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle,
        rgba(59, 130, 246, 0.4) 0%,
        transparent 70%);
    border-radius: 50%;
    animation: burst-ring 0.6s ease-out forwards;
}

@keyframes burst-expand {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(3);
        opacity: 0;
    }
}

@keyframes burst-ring {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Jackpot effect */
.jackpot-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1700;
    animation: jackpot-flash 0.8s ease-out forwards;
}

@keyframes jackpot-flash {
    0% {
        background: radial-gradient(circle at 50% 50%,
            rgba(255, 215, 0, 0.6) 0%,
            transparent 50%);
    }
    50% {
        background: radial-gradient(circle at 50% 50%,
            rgba(255, 215, 0, 0.3) 0%,
            transparent 70%);
    }
    100% {
        background: transparent;
    }
}

/* Screen shake */
.screen-shake {
    animation: shake-effect 0.3s ease-out;
}

@keyframes shake-effect {
    0%, 100% { transform: translateX(0) translateY(0); }
    10% { transform: translateX(-5px) translateY(-2px); }
    20% { transform: translateX(5px) translateY(2px); }
    30% { transform: translateX(-4px) translateY(-1px); }
    40% { transform: translateX(4px) translateY(1px); }
    50% { transform: translateX(-3px) translateY(-1px); }
    60% { transform: translateX(3px) translateY(1px); }
    70% { transform: translateX(-2px) translateY(0); }
    80% { transform: translateX(2px) translateY(0); }
    90% { transform: translateX(-1px) translateY(0); }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .pachinko-ball,
    .chip-particle,
    .line-flash,
    .score-burst,
    .jackpot-effect,
    .screen-shake {
        animation: none !important;
    }

    .scanlines {
        animation: none !important;
    }
}

.reduced-motion .pachinko-ball,
.reduced-motion .chip-particle,
.reduced-motion .line-flash,
.reduced-motion .score-burst,
.reduced-motion .jackpot-effect {
    display: none !important;
}

.reduced-motion .screen-shake {
    animation: none !important;
}
