/* ========================================
   MINI-GAME - Fruit Ninja Slicer
   Addictive slicing game during story generation
   ======================================== */

.minigame-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 50%, #fbbf24 100%);
    z-index: 10000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    user-select: none;
}

.minigame-container.active {
    display: flex;
}

.minigame-header {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10001;
}

.minigame-title {
    font-size: 32px;
    font-weight: 700;
    color: #7c2d12;
    text-shadow: 0 2px 8px rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
}

.minigame-subtitle {
    font-size: 16px;
    color: #92400e;
    font-weight: 600;
}

.minigame-score {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 20px;
    border-radius: 50px;
    font-size: 24px;
    font-weight: 700;
    color: #ea580c;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 10001;
}

.minigame-score i {
    color: #dc2626;
    margin-right: 8px;
}

.game-canvas {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><circle cx="16" cy="16" r="8" fill="%23dc2626" opacity="0.6"/></svg>') 16 16, crosshair;
    overflow: hidden;
    touch-action: none;
}

.game-fruit {
    position: absolute;
    font-size: 48px;
    user-select: none;
    pointer-events: none;
    z-index: 10000;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    transition: transform 0.05s ease;
}

.game-fruit.sliced {
    animation: fruitSlice 0.6s ease-out forwards;
}

.game-bomb {
    position: absolute;
    font-size: 40px;
    user-select: none;
    pointer-events: none;
    z-index: 10000;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    animation: bombPulse 0.8s ease-in-out infinite;
}

.game-bomb.exploded {
    animation: bombExplode 0.5s ease-out forwards;
}

@keyframes fruitSlice {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.2) rotate(20deg);
    }
    100% {
        transform: scale(0) rotate(90deg) translateY(50px);
        opacity: 0;
    }
}

@keyframes bombPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes bombExplode {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(2);
        opacity: 0.5;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.game-particle {
    position: absolute;
    font-size: 24px;
    pointer-events: none;
    animation: particleFade 0.8s ease-out forwards;
    z-index: 9999;
}

@keyframes particleFade {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0) rotate(360deg);
        opacity: 0;
    }
}

.slice-trail {
    position: absolute;
    pointer-events: none;
    z-index: 9998;
}

.slice-line {
    position: absolute;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    height: 3px;
    border-radius: 2px;
    animation: sliceFade 0.4s ease-out forwards;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
}

@keyframes sliceFade {
    0% {
        opacity: 1;
        width: 0;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        opacity: 0;
    }
}

.combo-text {
    position: absolute;
    font-size: 32px;
    font-weight: 900;
    color: #dc2626;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 0 2px 4px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 10002;
    animation: comboPopup 1s ease-out forwards;
}

@keyframes comboPopup {
    0% {
        transform: scale(0) translateY(0);
        opacity: 0;
    }
    30% {
        transform: scale(1.5) translateY(-20px);
        opacity: 1;
    }
    70% {
        transform: scale(1.2) translateY(-40px);
        opacity: 1;
    }
    100% {
        transform: scale(0.8) translateY(-80px);
        opacity: 0;
    }
}

.minigame-progress {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 16px 24px;
    border-radius: 16px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    z-index: 10001;
}

.minigame-progress-text {
    font-size: 14px;
    color: #0f766e;
    font-weight: 600;
    margin-bottom: 8px;
}

.minigame-progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.minigame-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #14b8a6 0%, #10b981 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.minigame-close {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 20px;
    color: #64748b;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    z-index: 10001;
    transition: all 0.2s ease;
}

.minigame-close:hover {
    background: #ffffff;
    color: #ef4444;
    transform: scale(1.1);
}

.minigame-clouds {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.game-cloud {
    position: absolute;
    font-size: 60px;
    opacity: 0.3;
    animation: cloudFloat 20s linear infinite;
}

@keyframes cloudFloat {
    0% {
        transform: translateX(-100px);
    }
    100% {
        transform: translateX(calc(100vw + 100px));
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .minigame-title {
        font-size: 24px;
    }
    
    .minigame-subtitle {
        font-size: 14px;
    }
    
    .minigame-score {
        font-size: 20px;
        padding: 10px 16px;
    }
    
    .game-star {
        font-size: 35px;
    }
    
    .minigame-progress {
        bottom: 20px;
        padding: 12px 16px;
    }
}

/* ========================================
   CLOUD HOPPER - Flappy Bird-style Game
   ======================================== */

.minigame-container.flappy-game {
    background: linear-gradient(180deg, #87CEEB 0%, #E0F6FF 50%, #FFF5E6 100%);
}

.flappy-game .minigame-title {
    color: #1e40af;
    text-shadow: 0 2px 8px rgba(255, 255, 255, 0.8);
}

.flappy-game .minigame-subtitle {
    color: #3b82f6;
}

.flappy-game .minigame-score {
    color: #f59e0b;
}

.flappy-game .minigame-score i {
    color: #f59e0b;
}

.flappy-canvas {
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    background: transparent;
}

.flappy-high-score {
    position: absolute;
    top: 70px;
    right: 20px;
    background: rgba(255, 255, 255, 0.8);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    z-index: 10001;
}

.flappy-start-overlay,
.flappy-game-over {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10002;
}

.flappy-start-content,
.flappy-game-over-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px 60px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.flappy-bird-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.flappy-start-text {
    font-size: 20px;
    font-weight: 600;
    color: #1e40af;
}

.flappy-game-over-title {
    font-size: 36px;
    font-weight: 800;
    color: #dc2626;
    margin-bottom: 16px;
}

.flappy-final-score {
    font-size: 24px;
    font-weight: 700;
    color: #f59e0b;
    margin-bottom: 20px;
}

.flappy-restart-text {
    font-size: 16px;
    color: #6b7280;
}

.minigame-background-hint {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 8px;
    font-style: italic;
}

/* Flappy game mobile optimizations */
@media (max-width: 768px) {
    .flappy-start-content,
    .flappy-game-over-content {
        padding: 30px 40px;
        margin: 20px;
    }
    
    .flappy-bird-icon {
        font-size: 48px;
    }
    
    .flappy-start-text {
        font-size: 16px;
    }
    
    .flappy-game-over-title {
        font-size: 28px;
    }
    
    .flappy-high-score {
        top: 65px;
        font-size: 12px;
    }
}
