/* ==================== TETRIS CORNER BUTTON ==================== */
.tetris-corner-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99998;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    animation: tetris-pulse 2s infinite;
}

.tetris-corner-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.tetris-corner-btn:active {
    transform: translateY(0) scale(1);
}

.tetris-icon {
    font-size: 20px;
}

.tetris-label {
    font-size: 13px;
}

@keyframes tetris-pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4); }
    50% { box-shadow: 0 4px 25px rgba(102, 126, 234, 0.7); }
}

/* Responsive: Hide label on small screens */
@media (max-width: 480px) {
    .tetris-corner-btn {
        padding: 10px 12px;
    }
    .tetris-label {
        display: none;
    }
}

/* ==================== MODAL OVERLAY ==================== */
.tetris-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.tetris-modal.active {
    opacity: 1;
    visibility: visible;
}

.tetris-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(3px);
    cursor: pointer;
}

.tetris-modal-content {
    position: relative;
    background: #1a1a2e;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.tetris-modal.active .tetris-modal-content {
    transform: scale(1) translateY(0);
}

/* ==================== MODAL HEADER ==================== */
.tetris-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.tetris-modal-header h2 {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.tetris-close-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tetris-close-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

.tetris-close-btn span {
    margin-top: -2px;
}

/* ==================== MODAL BODY ==================== */
.tetris-modal-body {
    padding: 20px;
    overflow: auto;
}

.tetris-game-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

#tetris-canvas {
    border: 3px solid #667eea;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
    background: #111;
}

/* ==================== SIDEBAR ==================== */
.tetris-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 140px;
}

.tetris-next-piece {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
}

.tetris-next-piece h3,
.tetris-controls-info h3 {
    margin: 0 0 12px 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#tetris-next {
    background: #0f0f1a;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}

.tetris-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tetris-stat {
    display: flex;
    flex-direction: column;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 10px 12px;
}

.tetris-stat-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tetris-stat-value {
    font-family: 'Courier New', monospace;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.tetris-controls-info {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 12px;
}

.tetris-controls-info ul {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 12px;
}

.tetris-controls-info li {
    color: #aaa;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tetris-controls-info kbd {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #fff;
    min-width: 24px;
    text-align: center;
}

/* ==================== MODAL FOOTER ==================== */
.tetris-modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    background: rgba(0,0,0,0.3);
    border-top: 1px solid rgba(255,255,255,0.1);
}

.tetris-action-btn {
    flex: 1;
    padding: 12px 24px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tetris-start-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

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

.tetris-pause-btn {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.tetris-pause-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.2);
}

.tetris-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .tetris-modal-content {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .tetris-game-container {
        flex-direction: column;
        align-items: center;
    }
    
    .tetris-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
    }
    
    .tetris-next-piece,
    .tetris-controls-info {
        flex: 1;
        min-width: 120px;
    }
    
    .tetris-stats {
        flex-direction: row;
        flex: 2;
    }
    
    .tetris-stat {
        flex: 1;
        text-align: center;
    }
    
    #tetris-canvas {
        max-width: 100%;
        height: auto;
    }
}

@media (max-width: 480px) {
    .tetris-modal-header {
        padding: 12px 16px;
    }
    
    .tetris-modal-header h2 {
        font-size: 18px;
    }
    
    .tetris-modal-body {
        padding: 12px;
    }
    
    .tetris-modal-footer {
        padding: 12px 16px;
    }
    
    .tetris-controls-info {
        display: none;
    }
    
    .tetris-sidebar {
        flex-direction: column;
    }
    
    .tetris-stats {
        flex-direction: row;
    }
}