/**
 * games.css - Games Hub Page Styles
 *
 * Styles specific to the games hub page (games.html).
 * Includes game card grid, hidden card effects, and animations.
 */

/* ========================================
   KEYFRAME ANIMATIONS
   ======================================== */

@keyframes secretSpin {
    to { transform: rotate(360deg); }
}

@keyframes mysteryPulse {
    0%, 100% { transform: scale(1); filter: hue-rotate(0deg); }
    50% { transform: scale(1.1); filter: hue-rotate(30deg); }
}

@keyframes titleWobble {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-100px); }
}

@keyframes rainbowPulse {
    0% { box-shadow: 0 10px 40px rgba(0,0,0,0.2); }
    50% { box-shadow: 0 0 30px var(--glow-color), 0 0 60px var(--glow-color); }
    100% { box-shadow: 0 10px 40px rgba(0,0,0,0.2); }
}

@keyframes dizzyWobble {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(2deg); }
    50% { transform: rotate(-2deg); }
    75% { transform: rotate(1.5deg); }
    100% { transform: rotate(0deg); }
}

@keyframes swirlSpin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes swapBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

@keyframes cardFlipOut {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}
@keyframes cardFlipIn {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}
@keyframes naughtyWiggle {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px) rotate(-2deg); }
    40% { transform: translateX(8px) rotate(2deg); }
    60% { transform: translateX(-5px) rotate(-1deg); }
    80% { transform: translateX(5px) rotate(1deg); }
}
@keyframes emojiExplode {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--ex), var(--ey)) scale(0.3); opacity: 0; }
}
@keyframes speechPop {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    60% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
@keyframes floatZ {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-60px); opacity: 0; }
}
@keyframes scanlineScroll {
    0% { background-position: 0 0; }
    100% { background-position: 0 4px; }
}

/* ========================================
   RESET
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    padding: 20px;
}

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

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

h1 {
    color: white;
    font-size: 2.2rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,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;
}

.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;
}

/* ========================================
   GAME CARDS
   ======================================== */

.game-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none;
    display: block;
}

.game-card:hover, .game-card:active {
    transform: translateY(-10px);
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

.game-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    display: block;
}

.game-card h2 {
    color: #11998e;
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.game-card p {
    color: #666;
    font-size: 1rem;
    line-height: 1.4;
}

/* ========================================
   HIDDEN GAME CARD
   ======================================== */

.hidden-game-card {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.95), rgba(75, 0, 130, 0.95));
    border-radius: 25px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(138, 43, 226, 0.4);
    text-decoration: none;
    display: block;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 2s ease, transform 2s ease;
    border: 3px dashed rgba(255,255,255,0.5);
    position: relative;
    overflow: hidden;
    pointer-events: none;
}

.hidden-game-card.revealed {
    opacity: 1;
    transform: translateY(0);
}

.hidden-game-card.clickable {
    pointer-events: auto;
}

.hidden-game-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: secretSpin 4s linear infinite;
    pointer-events: none;
}

.hidden-game-card .game-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    display: block;
    animation: mysteryPulse 2s ease infinite;
}

.hidden-game-card h2 {
    color: #ffd700;
    font-size: 1.5rem;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(255,215,0,0.5);
}

.hidden-game-card p {
    color: rgba(255,255,255,0.9);
    font-size: 1rem;
    line-height: 1.4;
}

.hidden-game-card:hover, .hidden-game-card:active {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 50px rgba(138, 43, 226, 0.6);
}

/* ========================================
   CARD SHUFFLE (SHAKE)
   ======================================== */

.game-card.shuffling {
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.3, 1.2) !important;
    z-index: 50;
    transform: translate(var(--shuffle-x, 0), var(--shuffle-y, 0)) rotate(var(--shuffle-r, 0));
}

/* ========================================
   RAINBOW GRID (CIRCLE GESTURE)
   ======================================== */

.game-card.rainbow-glow {
    animation: rainbowPulse 0.8s ease forwards;
}

.circle-indicator {
    position: fixed;
    border: 3px dashed rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    pointer-events: none;
    z-index: 999;
}

/* ========================================
   SPEED SCROLL (DIZZY)
   ======================================== */

body.dizzy-mode {
    animation: dizzyWobble 0.3s ease infinite;
}

.dizzy-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 200vmax;
    height: 200vmax;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9998;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        rgba(255, 255, 255, 0.08) 60deg,
        transparent 120deg,
        rgba(255, 255, 255, 0.08) 180deg,
        transparent 240deg,
        rgba(255, 255, 255, 0.08) 300deg,
        transparent 360deg
    );
    animation: swirlSpin 2s linear infinite;
    opacity: 0.7;
    transition: opacity 0.5s;
}

.dizzy-overlay.fading {
    opacity: 0;
}

/* ========================================
   CARD SWAP (DRAG & DROP)
   ======================================== */

.game-card.drag-source {
    opacity: 0.4;
    transform: scale(0.95) !important;
    transition: opacity 0.2s, transform 0.2s !important;
}

.game-card.drag-target {
    box-shadow: 0 0 20px rgba(17, 153, 142, 0.6), 0 10px 40px rgba(0, 0, 0, 0.3) !important;
    transform: scale(1.03);
    transition: box-shadow 0.2s, transform 0.2s !important;
}

.drag-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.85;
    transform: scale(1.05) rotate(3deg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    text-align: center;
    max-width: 280px;
}

.game-card.swap-bounce {
    animation: swapBounce 0.3s ease;
}

/* ========================================
   GRAVITY TILT
   ======================================== */

.game-card.tilt-enabled {
    transition: transform 0.15s ease-out;
}

/* ========================================
   CARD FLIP
   ======================================== */

.game-card.flip-out {
    animation: cardFlipOut 0.15s ease-in forwards;
}
.game-card.flip-in {
    animation: cardFlipIn 0.15s ease-out forwards;
}
.game-card.flipped .flip-joke {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    font-size: 1.1rem;
    color: #11998e;
    font-style: italic;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
    padding: 10px;
}

/* ========================================
   NAUGHTY TAP
   ======================================== */

.naughty-message.wiggling {
    animation: naughtyWiggle 0.4s ease;
}
.naughty-exploding {
    position: fixed;
    font-size: 2.5rem;
    pointer-events: none;
    z-index: 1000;
    animation: emojiExplode 0.8s ease-out forwards;
}

/* ========================================
   KONAMI RETRO MODE
   ======================================== */

body.retro-mode {
    filter: contrast(1.5) saturate(2) brightness(1.1);
    transition: filter 0.3s;
}
.retro-scanlines {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.15) 2px,
        rgba(0, 0, 0, 0.15) 4px
    );
    animation: scanlineScroll 0.5s linear infinite;
    opacity: 1;
    transition: opacity 0.5s;
}
.retro-scanlines.fading {
    opacity: 0;
}

/* ========================================
   SECRET TYPER SPEECH BUBBLE
   ======================================== */

.dad-speech-bubble {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: white;
    border-radius: 20px;
    padding: 25px 35px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    max-width: 320px;
    text-align: center;
    font-size: 1.2rem;
    color: #333;
    line-height: 1.5;
    animation: speechPop 0.4s ease forwards;
}
.dad-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -15px; left: 50%;
    transform: translateX(-50%);
    border: 15px solid transparent;
    border-top-color: white;
    border-bottom: 0;
}
.dad-speech-bubble.fading {
    opacity: 0;
    transition: opacity 0.3s;
}

/* ========================================
   SLEEPY CARDS
   ======================================== */

.game-card.sleepy {
    transform: rotate(var(--tilt, -3deg));
    opacity: 0.7;
    transition: transform 0.5s ease, opacity 0.5s ease;
}
.floating-z {
    position: fixed;
    font-size: 1.5rem;
    pointer-events: none;
    z-index: 100;
    animation: floatZ 2s ease-in-out infinite;
    opacity: 0.8;
}

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

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

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

    .game-card {
        padding: 25px 20px;
    }

    .game-icon {
        font-size: 3rem;
    }

    .game-card h2 {
        font-size: 1.3rem;
    }

    .drag-ghost {
        max-width: 200px;
        padding: 20px;
    }

    .dad-speech-bubble {
        max-width: 85vw;
        padding: 20px 25px;
        font-size: 1rem;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
