/* Game Hub Unified Design - Extravagant & Animated */

/* ============================================
   Card Simplification - Remove icons, keep info
   ============================================ */

/* Hide the icon containers entirely */
.game-card .game-icon {
    display: none !important;
}

/* Simplified card layout */
.game-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px 25px;
    min-height: 80px;
    background-color: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
    cursor: pointer;
}

/* Game info takes full width now */
.game-card .game-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
    z-index: 2;
}

.game-card .game-name {
    font-size: 20px;
    font-weight: bold;
    color: var(--text-primary);
    margin: 0;
    transition: text-shadow 0.1s ease;
}

.game-card .game-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* Badge container */
.game-card .game-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

/* ============================================
   Glitch Overlay - CRT static effect
   ============================================ */

.card-glitch-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    opacity: 0;
    z-index: 1;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.1) 2px,
        rgba(0, 0, 0, 0.1) 4px
    );
    mix-blend-mode: overlay;
}

/* Static noise texture */
.card-glitch-overlay::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    right: -50%;
    bottom: -50%;
    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");
    opacity: 0.15;
    animation: noise-shift 0.1s steps(3) infinite;
}

/* Chromatic aberration layers */
.card-glitch-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        rgba(255, 0, 0, 0.1) 0%,
        transparent 33%,
        transparent 66%,
        rgba(0, 255, 255, 0.1) 100%
    );
    animation: chromatic-shift 0.15s steps(2) infinite;
}

@keyframes noise-shift {
    0% { transform: translate(0, 0); }
    33% { transform: translate(-5%, -5%); }
    66% { transform: translate(5%, 5%); }
    100% { transform: translate(0, 0); }
}

@keyframes chromatic-shift {
    0% { transform: translateX(-3px); }
    50% { transform: translateX(3px); }
    100% { transform: translateX(-3px); }
}

/* ============================================
   Hover State - Full glitch effect
   ============================================ */

.game-card:hover {
    border-color: var(--border-accent);
    box-shadow:
        0 0 20px var(--shadow-color),
        inset 0 0 30px rgba(0, 255, 0, 0.03);
    animation: card-shake 0.15s ease-in-out;
}

.game-card:hover .card-glitch-overlay {
    opacity: 1;
}

.game-card:hover .game-name {
    text-shadow:
        2px 0 rgba(255, 0, 0, 0.4),
        -2px 0 rgba(0, 255, 255, 0.4);
    animation: text-glitch 0.2s steps(2) infinite;
}

@keyframes card-shake {
    0%, 100% { transform: translateX(0) translateY(0); }
    20% { transform: translateX(-2px) translateY(1px); }
    40% { transform: translateX(2px) translateY(-1px); }
    60% { transform: translateX(-1px) translateY(2px); }
    80% { transform: translateX(1px) translateY(-2px); }
}

@keyframes text-glitch {
    0% {
        text-shadow:
            2px 0 rgba(255, 0, 0, 0.5),
            -2px 0 rgba(0, 255, 255, 0.5);
    }
    25% {
        text-shadow:
            -2px 0 rgba(255, 0, 0, 0.5),
            2px 0 rgba(0, 255, 255, 0.5);
    }
    50% {
        text-shadow:
            2px 1px rgba(255, 0, 0, 0.5),
            -2px -1px rgba(0, 255, 255, 0.5);
    }
    75% {
        text-shadow:
            -1px -1px rgba(255, 0, 0, 0.5),
            1px 1px rgba(0, 255, 255, 0.5);
    }
    100% {
        text-shadow:
            1px 0 rgba(255, 0, 0, 0.5),
            -1px 0 rgba(0, 255, 255, 0.5);
    }
}

/* ============================================
   Text Flicker Effect
   ============================================ */

.game-card:hover .game-desc {
    animation: text-flicker 0.3s ease-in-out;
}

@keyframes text-flicker {
    0%, 100% { opacity: 1; }
    10% { opacity: 0.8; }
    20% { opacity: 1; }
    30% { opacity: 0.9; }
    40% { opacity: 1; }
    50% { opacity: 0.85; }
    60% { opacity: 1; }
    70% { opacity: 0.95; }
    80% { opacity: 1; }
    90% { opacity: 0.9; }
}

/* ============================================
   Click Effect
   ============================================ */

.game-card:active {
    transform: scale(0.98);
    box-shadow:
        0 0 30px var(--border-accent),
        inset 0 0 50px rgba(0, 255, 0, 0.05);
}

.game-card:active .card-glitch-overlay {
    opacity: 1;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 1px,
        rgba(0, 0, 0, 0.2) 1px,
        rgba(0, 0, 0, 0.2) 2px
    );
}

/* ============================================
   Sprite Parade Container
   ============================================ */

.sprite-parade {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

.sprite {
    position: absolute;
    bottom: 8px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: nearest-neighbor;
    transition: none;
}

.sprite.walking-left {
    transform: scaleX(-1);
}

/* Sprite walking animation - bouncy hop */
@keyframes sprite-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes sprite-bob-high {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-14px); }
}

@keyframes sprite-bob-small {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.sprite.animating {
    animation: sprite-bob 0.25s ease-in-out infinite;
}

.sprite.animating.hop-high {
    animation: sprite-bob-high 0.3s ease-in-out infinite;
}

.sprite.animating.hop-small {
    animation: sprite-bob-small 0.2s ease-in-out infinite;
}

.sprite.walking-left.animating {
    animation: sprite-bob-flip 0.25s ease-in-out infinite;
}

.sprite.walking-left.animating.hop-high {
    animation: sprite-bob-flip-high 0.3s ease-in-out infinite;
}

.sprite.walking-left.animating.hop-small {
    animation: sprite-bob-flip-small 0.2s ease-in-out infinite;
}

@keyframes sprite-bob-flip {
    0%, 100% { transform: scaleX(-1) translateY(0); }
    50% { transform: scaleX(-1) translateY(-8px); }
}

@keyframes sprite-bob-flip-high {
    0%, 100% { transform: scaleX(-1) translateY(0); }
    50% { transform: scaleX(-1) translateY(-14px); }
}

@keyframes sprite-bob-flip-small {
    0%, 100% { transform: scaleX(-1) translateY(0); }
    50% { transform: scaleX(-1) translateY(-4px); }
}

/* ============================================
   Mobile Adjustments
   ============================================ */

@media (max-width: 600px) {
    .game-card {
        padding: 15px 20px;
        min-height: 70px;
    }

    .game-card .game-name {
        font-size: 18px;
    }

    .game-card .game-desc {
        font-size: 12px;
    }

    /* Reduce glitch intensity on mobile */
    .game-card:hover {
        animation: none;
    }

    .game-card:hover .game-name {
        text-shadow:
            1px 0 rgba(255, 0, 0, 0.3),
            -1px 0 rgba(0, 255, 255, 0.3);
    }

    .sprite-parade {
        height: 70px;
    }
}

/* ============================================
   Reduced Motion Support
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .game-card,
    .game-card:hover,
    .game-card .game-name,
    .game-card .game-desc,
    .card-glitch-overlay,
    .card-glitch-overlay::before,
    .card-glitch-overlay::after,
    .sprite {
        animation: none !important;
        transition: none !important;
    }

    .game-card:hover .card-glitch-overlay {
        opacity: 0.3;
    }

    .game-card:hover .game-name {
        text-shadow: none;
    }

    .sprite-parade {
        display: none;
    }
}

/* ============================================
   Coming Soon Cards
   ============================================ */

.game-card.coming-soon {
    opacity: 0.6;
    cursor: not-allowed;
}

.game-card.coming-soon:hover {
    animation: none;
    transform: none;
    border-color: var(--border-color);
    box-shadow: none;
}

.game-card.coming-soon:hover .card-glitch-overlay {
    opacity: 0;
}

.game-card.coming-soon:hover .game-name {
    text-shadow: none;
    animation: none;
}

/* ============================================
   Card Entrance Animation
   ============================================ */

.game-card {
    opacity: 0;
    transform: translateY(20px);
}

.game-card.card-entered {
    animation: card-enter 0.3s ease-out forwards;
}

@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered delays for up to 12 cards */
.game-card:nth-child(1).card-entered { animation-delay: 0ms; }
.game-card:nth-child(2).card-entered { animation-delay: 50ms; }
.game-card:nth-child(3).card-entered { animation-delay: 100ms; }
.game-card:nth-child(4).card-entered { animation-delay: 150ms; }
.game-card:nth-child(5).card-entered { animation-delay: 200ms; }
.game-card:nth-child(6).card-entered { animation-delay: 250ms; }
.game-card:nth-child(7).card-entered { animation-delay: 300ms; }
.game-card:nth-child(8).card-entered { animation-delay: 350ms; }
.game-card:nth-child(9).card-entered { animation-delay: 400ms; }
.game-card:nth-child(10).card-entered { animation-delay: 450ms; }
.game-card:nth-child(11).card-entered { animation-delay: 500ms; }
.game-card:nth-child(12).card-entered { animation-delay: 550ms; }

/* Coming soon cards stay dimmed after entrance */
.game-card.coming-soon.card-entered {
    animation: card-enter-dimmed 0.3s ease-out forwards;
}

@keyframes card-enter-dimmed {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 0.6;
        transform: translateY(0);
    }
}

/* ============================================
   Floating Particles
   ============================================ */

.particle-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.floating-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background-color: var(--border-accent, #00ff00);
    opacity: 0;
    animation: particle-float 8s linear forwards;
}

.floating-particle.size-small {
    width: 2px;
    height: 2px;
}

.floating-particle.size-large {
    width: 4px;
    height: 4px;
}

@keyframes particle-float {
    0% {
        opacity: 0;
        transform: translateY(0) translateX(0);
    }
    10% {
        opacity: 0.4;
    }
    80% {
        opacity: 0.3;
    }
    100% {
        opacity: 0;
        transform: translateY(-100vh) translateX(20px);
    }
}

/* ============================================
   Cursor Trail
   ============================================ */

.cursor-trail-particle {
    position: fixed;
    width: 6px;
    height: 6px;
    background-color: var(--border-accent, #00ff00);
    pointer-events: none;
    z-index: 9999;
    opacity: 0.9;
    box-shadow:
        0 0 4px var(--border-accent, #00ff00),
        0 0 8px var(--border-accent, #00ff00);
    animation: trail-fade 0.6s ease-out forwards;
}

.cursor-trail-particle.size-small {
    width: 4px;
    height: 4px;
    box-shadow: 0 0 3px var(--border-accent, #00ff00);
}

.cursor-trail-particle.size-large {
    width: 8px;
    height: 8px;
    box-shadow:
        0 0 6px var(--border-accent, #00ff00),
        0 0 12px var(--border-accent, #00ff00);
}

@keyframes trail-fade {
    0% {
        opacity: 0.9;
        transform: translateY(0) scale(1);
    }
    50% {
        opacity: 0.6;
    }
    100% {
        opacity: 0;
        transform: translateY(25px) scale(0.2);
    }
}

/* ============================================
   Random Arcade Events
   ============================================ */

/* INSERT COIN Flash */
.insert-coin-flash {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: inherit;
    font-size: 32px;
    font-weight: bold;
    color: var(--border-accent, #00ff00);
    text-shadow:
        0 0 10px var(--border-accent, #00ff00),
        0 0 20px var(--border-accent, #00ff00),
        0 0 30px var(--border-accent, #00ff00);
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    animation: insert-coin-blink 1.5s steps(2) forwards;
    letter-spacing: 4px;
}

@keyframes insert-coin-blink {
    0%, 20%, 40%, 60%, 80% { opacity: 1; }
    10%, 30%, 50%, 70%, 90% { opacity: 0; }
    100% { opacity: 0; }
}

/* Screen Glitch Effect */
.screen-glitch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 999;
    background: transparent;
    animation: screen-glitch 0.3s steps(4) forwards;
}

@keyframes screen-glitch {
    0% {
        background: transparent;
        transform: translateX(0);
    }
    20% {
        background: rgba(255, 0, 0, 0.03);
        transform: translateX(-5px);
    }
    40% {
        background: rgba(0, 255, 255, 0.03);
        transform: translateX(5px);
    }
    60% {
        background: rgba(255, 0, 0, 0.02);
        transform: translateX(-3px);
    }
    80% {
        background: rgba(0, 255, 255, 0.02);
        transform: translateX(3px);
    }
    100% {
        background: transparent;
        transform: translateX(0);
    }
}

.screen-glitch-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.1) 2px,
        rgba(0, 0, 0, 0.1) 4px
    );
    animation: scanlines-glitch 0.1s steps(2) infinite;
}

@keyframes scanlines-glitch {
    0% { transform: translateY(0); }
    50% { transform: translateY(2px); }
    100% { transform: translateY(0); }
}

/* Score Popup */
.score-popup {
    position: fixed;
    font-family: inherit;
    font-size: 18px;
    font-weight: bold;
    color: var(--border-accent, #00ff00);
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    animation: score-float 1.5s ease-out forwards;
    text-shadow: 0 0 5px var(--border-accent, #00ff00);
}

@keyframes score-float {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.8);
    }
}

/* Bonus Sprite (walks across bottom) */
.bonus-sprite {
    position: fixed;
    bottom: 80px;
    font-size: 24px;
    pointer-events: none;
    z-index: 100;
    animation: sprite-walk 6s linear forwards;
}

.bonus-sprite.walk-left {
    right: -50px;
    animation: sprite-walk-left 6s linear forwards;
}

.bonus-sprite.walk-right {
    left: -50px;
    animation: sprite-walk-right 6s linear forwards;
}

@keyframes sprite-walk-left {
    0% {
        right: -50px;
        transform: scaleX(-1);
    }
    100% {
        right: calc(100% + 50px);
        transform: scaleX(-1);
    }
}

@keyframes sprite-walk-right {
    0% {
        left: -50px;
        transform: scaleX(1);
    }
    100% {
        left: calc(100% + 50px);
        transform: scaleX(1);
    }
}

/* Bonus sprite bobbing animation */
.bonus-sprite::after {
    content: '';
    display: block;
    animation: bonus-bob 0.25s ease-in-out infinite;
}

@keyframes bonus-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* ============================================
   Reduced Motion - Disable all effects
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .game-card,
    .game-card.card-entered {
        opacity: 1;
        transform: none;
        animation: none !important;
    }

    .game-card.coming-soon,
    .game-card.coming-soon.card-entered {
        opacity: 0.6;
    }

    .particle-container,
    .floating-particle,
    .cursor-trail-particle,
    .insert-coin-flash,
    .screen-glitch-overlay,
    .score-popup,
    .bonus-sprite {
        display: none !important;
    }
}
