/**
 * Tetris Modal Overlay Styles (TMO Version)
 */

/* Trigger Button - Fixed Top-Right */
#tetris-trigger-btn-tmo {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 99998 !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4),
                0 0 0 4px rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    padding: 0;
    outline: none;
}

#tetris-trigger-btn-tmo:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6),
                0 0 0 6px rgba(255, 255, 255, 0.2);
}

#tetris-trigger-btn-tmo:active {
    transform: scale(0.95);
}

#tetris-trigger-btn-tmo .tetris-btn-icon {
    display: block;
    line-height: 1;
}

/* Modal Overlay */
#tetris-modal-tmo {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 99999 !important;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

#tetris-modal-tmo.active {
    display: flex;
}

#tetris-modal-tmo.closing {
    animation: tetris-fade-out 0.2s ease-out forwards;
}

@keyframes tetris-fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Modal Content */
#tetris-modal-tmo .tetris-modal-content {
    background: #1a1a2e;
    border-radius: 16px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: tetris-modal-in 0.3s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes tetris-modal-in {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Modal Header */
#tetris-modal-tmo .tetris-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#tetris-modal-tmo .tetris-modal-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #e94560;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#tetris-close-btn-tmo {
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

#tetris-close-btn-tmo:hover {
    background: rgba(233, 69, 96, 0.2);
    color: #e94560;
}

#tetris-close-btn-tmo:active {
    transform: scale(0.9);
}

/* Modal Body */
#tetris-modal-tmo .tetris-modal-body {
    padding: 24px;
    overflow-y: auto;
}

/* Game Container */
#tetris-modal-tmo .tetris-game-container {
    display: flex;
    justify-content: center;
}

#tetris-modal-tmo .tetris-game-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* Main Game Canvas */
#tetris-canvas-tmo {
    background: #0f0f23;
    border: 2px solid #4a4a6a;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

/* Sidebar */
#tetris-modal-tmo .tetris-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 120px;
}

#tetris-modal-tmo .tetris-sidebar h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #a0a0b0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#tetris-modal-tmo .tetris-sidebar span {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    font-family: 'Courier New', monospace;
}

/* Next Piece Preview */
#tetris-modal-tmo .tetris-next-piece {
    background: #16213e;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

#tetris-next-canvas-tmo {
    background: #0f0f23;
    border-radius: 4px;
}

/* Score/Level/Lines */
#tetris-modal-tmo .tetris-score,
#tetris-modal-tmo .tetris-level,
#tetris-modal-tmo .tetris-lines {
    background: #16213e;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

/* Controls Info */
#tetris-modal-tmo .tetris-controls {
    background: #16213e;
    padding: 12px;
    border-radius: 8px;
}

#tetris-modal-tmo .tetris-controls p {
    margin: 4px 0;
    font-size: 12px;
    color: #a0a0b0;
}

/* Start Button */
#tetris-start-btn-tmo {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: #fff;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s ease;
}

#tetris-start-btn-tmo:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#tetris-start-btn-tmo:active {
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 600px) {
    #tetris-modal-tmo .tetris-game-wrapper {
        flex-direction: column;
        align-items: center;
    }

    #tetris-modal-tmo .tetris-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        min-width: auto;
    }

    #tetris-modal-tmo .tetris-sidebar > div {
        flex: 1;
        min-width: 100px;
    }

    #tetris-canvas-tmo {
        max-width: 100%;
        height: auto;
    }

    #tetris-modal-tmo .tetris-modal-content {
        width: 95%;
        max-height: 95vh;
    }

    #tetris-modal-tmo .tetris-modal-body {
        padding: 16px;
    }

    #tetris-trigger-btn-tmo {
        width: 50px;
        height: 50px;
        font-size: 22px;
        top: 10px;
        right: 10px;
    }
}