/**
 * 🎮 TAMAGOTCHI MINI-GAMES CSS
 * Version 3.0 - Interface responsive pour mini-jeux
 * Mobile-first design avec support desktop
 */

/* ============================================
   MODAL MINI-JEU
   ============================================ */

.minigame-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.minigame-modal.active {
    opacity: 1;
    pointer-events: all;
}

.minigame-container {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.9));
    border: 2px solid rgba(6, 182, 212, 0.3);
    border-radius: 20px;
    padding: 1.5rem;
    max-width: 90vw;
    max-height: 90vh;
    width: 600px;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.minigame-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(6, 182, 212, 0.2);
}

.minigame-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #06b6d4;
    margin: 0;
}

.minigame-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.minigame-close:hover {
    color: #ef4444;
    transform: rotate(90deg);
}

.minigame-content {
    color: #e2e8f0;
}

/* ============================================
   MENU MINI-JEUX (Grid de sélection)
   ============================================ */

.minigame-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    padding: 1rem 0;
}

.minigame-menu-btn {
    background: linear-gradient(145deg, rgba(6, 182, 212, 0.15), rgba(16, 185, 129, 0.15));
    border: 2px solid rgba(6, 182, 212, 0.3);
    border-radius: 15px;
    padding: 1.5rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    color: #e2e8f0;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    /* Touch-friendly size */
    min-width: 44px;
}

.minigame-menu-btn:hover,
.minigame-menu-btn:active {
    background: linear-gradient(145deg, rgba(6, 182, 212, 0.25), rgba(16, 185, 129, 0.25));
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(6, 182, 212, 0.3);
}

.minigame-menu-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.minigame-menu-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.minigame-menu-desc {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.25rem;
}

/* ============================================
   1. PIERRE-PAPIER-CISEAUX
   ============================================ */

.rps-game {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.rps-score {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 1rem;
    background: rgba(6, 182, 212, 0.1);
    border-radius: 12px;
}

.rps-score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.rps-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.rps-value {
    font-size: 2rem;
    font-weight: 700;
    color: #10b981;
}

.rps-vs {
    font-size: 1.5rem;
    font-weight: 700;
    color: #8b5cf6;
}

.rps-display {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 2rem 1rem;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 12px;
}

.rps-choice-display {
    font-size: 4rem;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 50%;
    border: 3px solid rgba(6, 182, 212, 0.3);
}

.rps-vs-display {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fbbf24;
}

.rps-result {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    min-height: 2rem;
    color: #10b981;
}

.rps-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.rps-btn {
    background: linear-gradient(145deg, rgba(6, 182, 212, 0.2), rgba(16, 185, 129, 0.2));
    border: 2px solid rgba(6, 182, 212, 0.3);
    border-radius: 15px;
    padding: 1.5rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    /* Touch-friendly */
    min-height: 80px;
}

.rps-btn:hover,
.rps-btn:active {
    background: linear-gradient(145deg, rgba(6, 182, 212, 0.3), rgba(16, 185, 129, 0.3));
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(6, 182, 212, 0.3);
}

.rps-emoji {
    font-size: 2.5rem;
}

.rps-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.rps-info {
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.7;
}

/* ============================================
   2. JEU DE MÉMOIRE
   ============================================ */

.memory-game {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.memory-info {
    display: flex;
    justify-content: space-around;
    padding: 1rem;
    background: rgba(6, 182, 212, 0.1);
    border-radius: 12px;
}

.memory-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.memory-label {
    font-size: 0.85rem;
    opacity: 0.8;
}

.memory-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #10b981;
}

.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    padding: 1rem;
}

.memory-card {
    aspect-ratio: 1;
    cursor: pointer;
    perspective: 1000px;
    /* Touch-friendly minimum size */
    min-width: 60px;
    min-height: 60px;
}

.memory-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.memory-card.flipped .memory-card-inner {
    transform: rotateY(180deg);
}

.memory-card-front,
.memory-card-back {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    border-radius: 12px;
    border: 2px solid rgba(6, 182, 212, 0.3);
}

.memory-card-front {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.8));
}

.memory-card-back {
    background: linear-gradient(145deg, rgba(6, 182, 212, 0.3), rgba(16, 185, 129, 0.3));
    transform: rotateY(180deg);
}

.memory-card.matched .memory-card-inner {
    opacity: 0.5;
    pointer-events: none;
}

.memory-restart {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border: none;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    /* Touch-friendly */
    min-height: 44px;
}

.memory-restart:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.4);
}

/* ============================================
   3. ATTRAPE-SOURIS
   ============================================ */

.mouse-game {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.mouse-stats {
    display: flex;
    justify-content: space-around;
    padding: 1rem;
    background: rgba(6, 182, 212, 0.1);
    border-radius: 12px;
}

.mouse-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.mouse-label {
    font-size: 0.85rem;
    opacity: 0.8;
}

.mouse-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #10b981;
}

.mouse-playground {
    position: relative;
    width: 100%;
    height: 400px;
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.5), rgba(15, 23, 42, 0.5));
    border-radius: 12px;
    border: 2px solid rgba(6, 182, 212, 0.3);
    overflow: hidden;
}

.mouse-instructions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    font-size: 1.2rem;
    color: #e2e8f0;
    z-index: 1;
}

.mouse-target {
    position: absolute;
    font-size: 2rem;
    cursor: pointer;
    transition: transform 0.2s ease;
    animation: mouse-wiggle 0.5s infinite;
    /* Touch-friendly */
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes mouse-wiggle {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

.mouse-target:hover {
    transform: scale(1.2);
}

.mouse-target.caught {
    animation: mouse-caught 0.3s forwards;
}

@keyframes mouse-caught {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2) rotate(360deg);
        opacity: 0;
    }
}

.mouse-restart {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border: none;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    /* Touch-friendly */
    min-height: 44px;
}

.mouse-restart:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.4);
}

/* ============================================
   4. SIMON SAYS
   ============================================ */

.simon-game {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.simon-info {
    display: flex;
    justify-content: space-around;
    padding: 1rem;
    background: rgba(6, 182, 212, 0.1);
    border-radius: 12px;
}

.simon-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.simon-label {
    font-size: 0.85rem;
    opacity: 0.8;
}

.simon-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #10b981;
}

.simon-status {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 1rem;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 12px;
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.simon-board {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 1rem;
}

.simon-btn {
    aspect-ratio: 1;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 3px solid rgba(255, 255, 255, 0.2);
    /* Touch-friendly minimum */
    min-height: 100px;
}

.simon-btn:active,
.simon-btn.active {
    transform: scale(0.95);
    box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.5);
}

.simon-red {
    background: linear-gradient(145deg, #ef4444, #dc2626);
}

.simon-red.active {
    background: #fca5a5;
}

.simon-green {
    background: linear-gradient(145deg, #10b981, #059669);
}

.simon-green.active {
    background: #6ee7b7;
}

.simon-blue {
    background: linear-gradient(145deg, #3b82f6, #2563eb);
}

.simon-blue.active {
    background: #93c5fd;
}

.simon-yellow {
    background: linear-gradient(145deg, #fbbf24, #f59e0b);
}

.simon-yellow.active {
    background: #fde68a;
}

.simon-restart {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border: none;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    /* Touch-friendly */
    min-height: 44px;
}

.simon-restart:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.4);
}

/* ============================================
   BOUTON D'ACCÈS MINI-JEUX
   ============================================ */

.minigames-trigger {
    position: fixed;
    bottom: 110px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border: 3px solid rgba(139, 92, 246, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4);
    font-size: 1.8rem;
    opacity: 0;
    pointer-events: none;
}

.minigames-trigger.active {
    opacity: 1;
    pointer-events: all;
}

.minigames-trigger:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 12px 35px rgba(139, 92, 246, 0.6);
}

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

@media (max-width: 768px) {
    .minigame-container {
        width: 95vw;
        max-height: 85vh;
        padding: 1rem;
    }
    
    .minigame-title {
        font-size: 1.2rem;
    }
    
    .rps-buttons {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .rps-btn {
        flex-direction: row;
        justify-content: center;
        padding: 1rem;
    }
    
    .rps-emoji {
        font-size: 2rem;
    }
    
    .memory-grid {
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .memory-card-front,
    .memory-card-back {
        font-size: 2rem;
    }
    
    .mouse-playground {
        height: 300px;
    }
    
    .simon-board {
        gap: 0.75rem;
    }
    
    .minigames-trigger {
        bottom: 90px;
        right: 15px;
        width: 55px;
        height: 55px;
        font-size: 1.6rem;
    }
    
    .minigame-menu {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .minigame-menu-btn {
        padding: 1rem 0.5rem;
        min-height: 100px;
    }
    
    .minigame-menu-icon {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .rps-choice-display {
        font-size: 3rem;
        width: 80px;
        height: 80px;
    }
    
    .memory-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .mouse-playground {
        height: 250px;
    }
    
    .mouse-target {
        font-size: 1.5rem;
    }
}
